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 <kzak@redhat.com>
This commit is contained in:
Karel Zak 2020-05-28 12:51:26 +02:00
parent ecfa4dad6f
commit e4253d3ca4
2 changed files with 9 additions and 7 deletions

View File

@ -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 */

View File

@ -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.