[PATCH] fdisk: do not complain about regular files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 fdisk/gpt.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fdisk/gpt.c b/fdisk/gpt.c
index f1d751a..b8f3d33 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;
 	}
-- 
1.5.2.2

-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux