diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-12-15 05:58:28 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-12-15 05:59:02 +0100 |
commit | a831aa82248009ba1ee95ac6ebdbeb5234aaffea (patch) | |
tree | 4a0d4c21f58135c83ef3e40b9ec4868f27069f8c /wg-quick.c | |
parent | wg-quick: configurable search paths (diff) | |
download | android_kernel_wireguard-a831aa82248009ba1ee95ac6ebdbeb5234aaffea.tar.xz android_kernel_wireguard-a831aa82248009ba1ee95ac6ebdbeb5234aaffea.zip |
wg-quick: get proper command output status
Diffstat (limited to 'wg-quick.c')
-rw-r--r-- | wg-quick.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -20,6 +20,7 @@ #include <regex.h> #include <sys/types.h> #include <sys/stat.h> +#include <sys/wait.h> #include <sys/param.h> #ifndef WG_CONFIG_SEARCH_PATHS @@ -169,6 +170,11 @@ _printf_(1, 2) static void cmd(const char *cmd_fmt, ...) printf("[#] %s\n", cmd); ret = system(cmd); + if (ret < 0) + ret = ESRCH; + else if (ret > 0) + ret = WEXITSTATUS(ret); + if (ret && !is_exiting) exit(ret); } |