diff options
author | Karel Zak | 2015-03-17 11:10:20 +0100 |
---|---|---|
committer | Karel Zak | 2015-03-17 11:10:20 +0100 |
commit | 95305cec15750f2b6e938c9939f58fe70d252395 (patch) | |
tree | d53f1cc8b1bcc8fda371575788c5b3c2edcc1a61 | |
parent | hwclock: cosmetic changes to man page (diff) | |
download | kernel-qcow2-util-linux-95305cec15750f2b6e938c9939f58fe70d252395.tar.gz kernel-qcow2-util-linux-95305cec15750f2b6e938c9939f58fe70d252395.tar.xz kernel-qcow2-util-linux-95305cec15750f2b6e938c9939f58fe70d252395.zip |
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 <kzak@redhat.com>
-rw-r--r-- | disk-utils/blockdev.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c index ef6ee1d4d..2f6681ce2 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"), |