From c3e29c68f06facfc67206634338f2395e80c821d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thomas=20Wei=C3=9Fschuh?= Date: Mon, 2 Jan 2023 13:58:03 +0000 Subject: [PATCH] exitcodes: add EXIT_NOTSUPP --- include/exitcodes.h | 2 ++ sys-utils/blkdiscard.c | 6 ++---- tests/functions.sh | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/exitcodes.h b/include/exitcodes.h index f28f68e454..b29c98c0ed 100644 --- a/include/exitcodes.h +++ b/include/exitcodes.h @@ -22,4 +22,6 @@ #define FSCK_EX_USAGE 16 /* Usage or syntax error */ #define FSCK_EX_LIBRARY 128 /* Shared library error */ +#define EXIT_NOTSUPP 2 + #endif /* UTIL_LINUX_EXITCODES_H */ diff --git a/sys-utils/blkdiscard.c b/sys-utils/blkdiscard.c index 68e6f107f9..ed8d6a0036 100644 --- a/sys-utils/blkdiscard.c +++ b/sys-utils/blkdiscard.c @@ -47,9 +47,7 @@ #include "c.h" #include "closestream.h" #include "monotonic.h" - -/* exit() status if discard unsupported by device */ -#define BLKDISCARD_EXIT_NOTSUPP (EXIT_FAILURE + 1) +#include "exitcodes.h" #ifndef BLKDISCARD # define BLKDISCARD _IO(0x12,119) @@ -159,7 +157,7 @@ static void __attribute__((__noreturn__)) err_on_ioctl( const char *ioctlname, const char *path) { int exno = errno == EOPNOTSUPP ? - BLKDISCARD_EXIT_NOTSUPP : EXIT_FAILURE; + EXIT_NOTSUPP : EXIT_FAILURE; err(exno, _("%s: %s ioctl failed"), ioctlname, path); } diff --git a/tests/functions.sh b/tests/functions.sh index ed578d2e78..5752a2cdae 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -14,6 +14,7 @@ # GNU General Public License for more details. # +TS_EXIT_NOTSUPP=2 function ts_abspath { cd $1 -- 2.47.2