diff options
Diffstat (limited to '')
-rw-r--r-- | src/xz/main.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/xz/main.c b/src/xz/main.c index 0afd9ff7..8a6cde63 100644 --- a/src/xz/main.c +++ b/src/xz/main.c @@ -17,6 +17,10 @@ /// Exit status to use. This can be changed with set_exit_status(). static enum exit_status_type exit_status = E_SUCCESS; +/// True if --no-warn is specified. When this is true, we don't set +/// the exit status to E_WARNING when something worth a warning happens. +static bool no_warn = false; + extern void set_exit_status(enum exit_status_type new_status) @@ -31,6 +35,14 @@ set_exit_status(enum exit_status_type new_status) extern void +set_exit_no_warn(void) +{ + no_warn = true; + return; +} + + +extern void my_exit(enum exit_status_type status) { // Close stdout. If something goes wrong, print an error message @@ -59,6 +71,11 @@ my_exit(enum exit_status_type status) status = E_ERROR; } + // Suppress the exit status indicating a warning if --no-warn + // was specified. + if (status == E_WARNING && no_warn) + status = E_SUCCESS; + // If we have got a signal, raise it to kill the program. // Otherwise we just call exit(). signals_exit(); |