From: Karel Zak Date: Wed, 1 Aug 2007 13:06:18 +0000 (+0200) Subject: blockdev: fix "blockdev --getsz" for large devices X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3281d4268a192cbd1951347a4a857b94428dc958;p=util-linux blockdev: fix "blockdev --getsz" for large devices The "blockdev --getsz" command doesn't try to use BLKGETSIZE64 when previous BLKGETSIZE failed with EFBIG. This patch fixes this problem. Signed-off-by: Karel Zak --- diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c index 46b7fa71..0dd531c4 100644 --- a/disk-utils/blockdev.c +++ b/disk-utils/blockdev.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "nls.h" @@ -148,8 +149,10 @@ getsize(int fd, long long *sectors) { long long b; err = ioctl (fd, BLKGETSIZE, &sz); - if (err) - return err; + if (err) { + if (errno != EFBIG) + return err; + } err = ioctl(fd, BLKGETSIZE64, &b); if (err || b == 0 || b == sz) *sectors = sz;