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 <kzak@redhat.com>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
+#include <errno.h>
#include "nls.h"
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;