summaryrefslogtreecommitdiffstats
path: root/disk-utils/mkfs.cramfs.c
diff options
context:
space:
mode:
authorSami Kerola2014-07-13 18:36:33 +0200
committerSami Kerola2014-07-13 19:35:32 +0200
commit9cbf20040b2f8af98dcff0fc889208dde50e3dd4 (patch)
tree1aaa2ded7ce3c50087fe77964a90a000426301e8 /disk-utils/mkfs.cramfs.c
parentfdformat: match variable and print format types (diff)
downloadkernel-qcow2-util-linux-9cbf20040b2f8af98dcff0fc889208dde50e3dd4.tar.gz
kernel-qcow2-util-linux-9cbf20040b2f8af98dcff0fc889208dde50e3dd4.tar.xz
kernel-qcow2-util-linux-9cbf20040b2f8af98dcff0fc889208dde50e3dd4.zip
mkfs.cramfs: use defined failure name rather than magic value
From manual page; 'On error, the value MAP_FAILED is returned, and errno is set appropriately'. Reference: http://man7.org/linux/man-pages/man2/mmap.2.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'disk-utils/mkfs.cramfs.c')
-rw-r--r--disk-utils/mkfs.cramfs.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c
index 6f412d888..bae68ecb3 100644
--- a/disk-utils/mkfs.cramfs.c
+++ b/disk-utils/mkfs.cramfs.c
@@ -167,11 +167,9 @@ do_mmap(char *path, unsigned int size, unsigned int mode){
}
start = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
- if (-1 == (int) (long) start) {
- close(fd);
- err(MKFS_EX_ERROR, "mmap");
- }
close(fd);
+ if (start == MAP_FAILED)
+ err(MKFS_EX_ERROR, "mmap");
return start;
err:
free(start);