From 80443ab629a234e2af55dd9bcceb6fe150c6c79e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B6ppner?= Date: Wed, 31 Jul 2019 15:25:00 +0200 Subject: [PATCH] fdasd: Fix exit status in error cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In error cases, fdasd returns -1 which results in the return value 255. This is due to the fact that only the low-order 8 bits are used for the status value. See 2.13 Status Information [1] in the POSIX standard and the exit() POSIX man page [2] for more details. Instead of returning -1, use the EXIT_FAILURE constant to indicate unsuccessful termination properly. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html [2]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/exit.html Signed-off-by: Jan Höppner --- fdasd/fdasd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fdasd/fdasd.c b/fdasd/fdasd.c index 8f4ddf01..89dce9ed 100644 --- a/fdasd/fdasd.c +++ b/fdasd/fdasd.c @@ -397,7 +397,7 @@ static void fdasd_error(fdasd_anchor_t *anc, enum fdasd_failure why, char *str) fputc('\n', stderr); fputs(err_str, stderr); - fdasd_exit(anc, -1); + fdasd_exit(anc, EXIT_FAILURE); } /* @@ -3040,5 +3040,5 @@ int main(int argc, char *argv[]) } } - return -1; + return EXIT_FAILURE; }