]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Since 569d1dac7bc64457aac11163b6a91ce9b41a6715 we read device start
authorKarel Zak <kzak@redhat.com>
Tue, 17 Mar 2015 10:10:20 +0000 (11:10 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 17 Mar 2015 10:10:20 +0000 (11:10 +0100)
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>
disk-utils/blockdev.c

index ef6ee1d4d71be94d4725796597675b80432551f8..2f6681ce2da849d23c92aec1226c1a20089cd491 100644 (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"),