]> git.ipfire.org Git - thirdparty/util-linux.git/commit
umount: Make sure exit code does not overflow
authorNicolas Boichat <nicolas@boichat.ch>
Sat, 7 Jun 2014 13:38:00 +0000 (21:38 +0800)
committerNicolas Boichat <nicolas@boichat.ch>
Sat, 7 Jun 2014 13:46:02 +0000 (21:46 +0800)
commita9add961e9e95350171488925582e469e44bb2b5
tree0cb4c8906dc79c837110b8845925f79649ce2659
parent710ed55dcde95cad66a8f9bd2a7ecd223f14d653
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>
sys-utils/umount.c