Since 569d1dac7b we read device start

sector from the /sys/block/.../start file. The file exists only for
partitions, for wholedisk is the start of the device always zero.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1202443
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2015-03-17 11:10:20 +01:00
parent 8979e7024e
commit 95305cec15
1 changed files with 3 additions and 2 deletions

View File

@ -438,7 +438,6 @@ static void report_device(char *device, int quiet)
long ra;
unsigned long long bytes;
uint64_t start = 0;
struct sysfs_cxt cxt;
struct stat st;
fd = open(device, O_RDONLY | O_NONBLOCK);
@ -450,7 +449,9 @@ static void report_device(char *device, int quiet)
ro = ssz = bsz = 0;
ra = 0;
if (fstat(fd, &st) == 0) {
if (fstat(fd, &st) == 0 && !sysfs_devno_is_wholedisk(st.st_rdev)) {
struct sysfs_cxt cxt;
if (sysfs_init(&cxt, st.st_rdev, NULL))
err(EXIT_FAILURE,
_("%s: failed to initialize sysfs handler"),