summaryrefslogtreecommitdiffstats
path: root/fdisk/gpt.c
diff options
context:
space:
mode:
authorH. Peter Anvin2007-07-07 03:31:12 +0200
committerKarel Zak2007-07-10 13:11:13 +0200
commitbba382aafe34282797794915539225a23e11b1fc (patch)
tree1433bb610d82cedeeb7916dffac2fd04491e83de /fdisk/gpt.c
parentdocs: add release notes (diff)
downloadkernel-qcow2-util-linux-bba382aafe34282797794915539225a23e11b1fc.tar.gz
kernel-qcow2-util-linux-bba382aafe34282797794915539225a23e11b1fc.tar.xz
kernel-qcow2-util-linux-bba382aafe34282797794915539225a23e11b1fc.zip
fdisk: do not complain about regular files
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>
Diffstat (limited to 'fdisk/gpt.c')
-rw-r--r--fdisk/gpt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fdisk/gpt.c b/fdisk/gpt.c
index f1d751aca..b8f3d33d7 100644
--- a/fdisk/gpt.c
+++ b/fdisk/gpt.c
@@ -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;
}