]> err.no Git - util-linux/commitdiff
fdisk: do not complain about regular files
authorH. Peter Anvin <hpa@zytor.com>
Sat, 7 Jul 2007 01:31:12 +0000 (18:31 -0700)
committerKarel Zak <kzak@redhat.com>
Tue, 10 Jul 2007 11:11:13 +0000 (13:11 +0200)
fdisk complains that it doesn't understand regular files.  This can
be trivially fixed.

Also, modes are conventionally given in octal, not hex.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
fdisk/gpt.c

index f1d751aca388c3fe248715efa6cf306aacbf25bc..b8f3d33d71a1928a5c7cc05f1b827a338490574d 100644 (file)
@@ -173,10 +173,12 @@ last_lba(int fd)
        }
        if (S_ISBLK(s.st_mode))
                sectors = _get_num_sectors(fd);
+       else if (S_ISREG(s.st_mode))
+               sectors = s.st_size >> _get_sector_size(fd);
        else
        {
                fprintf(stderr,
-                       "last_lba(): I don't know how to handle files with mode %x\n",
+                       "last_lba(): I don't know how to handle files with mode %o\n",
                        s.st_mode);
                sectors = 1;
        }