From: Karel Zak Date: Tue, 17 Mar 2015 10:10:20 +0000 (+0100) Subject: Since 569d1dac7bc64457aac11163b6a91ce9b41a6715 we read device start X-Git-Tag: v2.27-rc1~346 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=95305cec15750f2b6e938c9939f58fe70d252395;p=thirdparty%2Futil-linux.git Since 569d1dac7bc64457aac11163b6a91ce9b41a6715 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 --- diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c index ef6ee1d4d7..2f6681ce2d 100644 --- a/disk-utils/blockdev.c +++ b/disk-utils/blockdev.c @@ -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"),