summaryrefslogtreecommitdiffstats
path: root/sys-utils/umount.c
diff options
context:
space:
mode:
authorNicolas Boichat2014-06-07 15:38:00 +0200
committerNicolas Boichat2014-06-07 15:46:02 +0200
commita9add961e9e95350171488925582e469e44bb2b5 (patch)
tree0cb4c8906dc79c837110b8845925f79649ce2659 /sys-utils/umount.c
parentlibsmartcols: add debug messages (diff)
downloadkernel-qcow2-util-linux-a9add961e9e95350171488925582e469e44bb2b5.tar.gz
kernel-qcow2-util-linux-a9add961e9e95350171488925582e469e44bb2b5.tar.xz
kernel-qcow2-util-linux-a9add961e9e95350171488925582e469e44bb2b5.zip
umount: Make sure exit code does not overflow
POSIX exit code is only 8-bit, and since umount sums up error codes, it can sometimes report success (exit code 0) even though a number of operations failed. For example, running, in an empty directory: umount `seq 1 7` returns 224 (7*32), since none of the 7 mount point exists but umount `seq 1 8` returns 0 (8*32=256) This patch clips the return value to 255. Signed-off-by: Nicolas Boichat <nicolas@boichat.ch>
Diffstat (limited to 'sys-utils/umount.c')
-rw-r--r--sys-utils/umount.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys-utils/umount.c b/sys-utils/umount.c
index 1ad9e6aeb..a75ff9ec1 100644
--- a/sys-utils/umount.c
+++ b/sys-utils/umount.c
@@ -646,6 +646,6 @@ int main(int argc, char **argv)
}
mnt_free_context(cxt);
- return rc;
+ return (rc < 256) ? rc : 255;
}