diff options
author | Karel Zak | 2012-07-23 11:40:46 +0200 |
---|---|---|
committer | Karel Zak | 2012-07-23 11:40:46 +0200 |
commit | ed3e0e373845fd7fb991a34386e49ffc48ca01d6 (patch) | |
tree | 5b4b3bc63297e39a1cf1a23ad4737f5b18d85a6b | |
parent | fdisk: (dos) cleanup function names (diff) | |
download | kernel-qcow2-util-linux-ed3e0e373845fd7fb991a34386e49ffc48ca01d6.tar.gz kernel-qcow2-util-linux-ed3e0e373845fd7fb991a34386e49ffc48ca01d6.tar.xz kernel-qcow2-util-linux-ed3e0e373845fd7fb991a34386e49ffc48ca01d6.zip |
fdisk: fix error message for too small devices
# touch ~/a
# fdisk -l ~/a
# fdisk: cannot open /root/a: Success
should be (at least):
fdisk: cannot open /root/a: Invalid argument
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | fdisks/utils.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fdisks/utils.c b/fdisks/utils.c index 07348d380..d8a4bd184 100644 --- a/fdisks/utils.c +++ b/fdisks/utils.c @@ -76,8 +76,11 @@ static int __init_mbr_buffer(struct fdisk_context *cxt) goto fail; /* read MBR */ - if (512 != read(cxt->dev_fd, cxt->mbr, 512)) + if (512 != read(cxt->dev_fd, cxt->mbr, 512)) { + if (errno == 0) + errno = EINVAL; /* probably too small file/device */ goto fail; + } return 0; fail: |