From: Karel Zak Date: Thu, 28 May 2020 10:51:26 +0000 (+0200) Subject: swapoff: do not use 1 exist status at all X-Git-Tag: v2.36-rc1~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4253d3ca40d12e2b4b19c1150ca0ef2d4482958;p=thirdparty%2Futil-linux.git swapoff: do not use 1 exist status at all The make sure we are not in collision with old versions. Addresses: https://github.com/karelzak/util-linux/issues/1050 Signed-off-by: Karel Zak --- diff --git a/sys-utils/swapoff.c b/sys-utils/swapoff.c index dade6fd5e9..7bfb90a3e7 100644 --- a/sys-utils/swapoff.c +++ b/sys-utils/swapoff.c @@ -26,9 +26,9 @@ static int all; #define CANONIC 1 #define SWAPOFF_EX_OK 0 /* no errors */ -#define SWAPOFF_EX_ENOMEM 1 /* swapoff(2) failed due to OOM */ -#define SWAPOFF_EX_FAILURE 2 /* swapoff(2) failed due to another reason */ -#define SWAPOFF_EX_SYSERR 4 /* non-swaoff() errors */ +#define SWAPOFF_EX_ENOMEM 2 /* swapoff(2) failed due to OOM */ +#define SWAPOFF_EX_FAILURE 4 /* swapoff(2) failed due to another reason */ +#define SWAPOFF_EX_SYSERR 8 /* non-swaoff() errors */ #define SWAPOFF_EX_USAGE 16 /* usage, permissions or syntax error */ #define SWAPOFF_EX_ALLERR 32 /* --all all failed */ #define SWAPOFF_EX_SOMEOK 64 /* --all some failed some OK */ diff --git a/sys-utils/swapon.8 b/sys-utils/swapon.8 index e43ceb54f2..b10076c908 100644 --- a/sys-utils/swapon.8 +++ b/sys-utils/swapon.8 @@ -189,18 +189,18 @@ Be verbose. Display version information and exit. .SH EXIT STATUS .B swapoff -has the following exit status values: +has the following exit status values since v2.36: .TP .B 0 success .TP -.B 1 +.B 2 system has insufficient memory to stop swapping (OOM) .TP -.B 2 +.B 4 swapoff syscall failed for another reason .TP -.B 4 +.B 8 non-swapoff syscall system error (out of memory, ...) .TP .B 16 @@ -215,6 +215,8 @@ some swapoff succeeded on \fB\-\-all\fR The command \fBswapoff \-\-all\fR returns 0 (all succeeded), 32 (all failed), or 64 (some failed, some succeeded). +The old versions before v2.36 has no documented exit status, 0 means success in all versions. + .SH ENVIRONMENT .IP LIBMOUNT_DEBUG=all enables libmount debug output.