aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-12-15 05:58:28 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2017-12-15 05:59:02 +0100
commita831aa82248009ba1ee95ac6ebdbeb5234aaffea (patch)
tree4a0d4c21f58135c83ef3e40b9ec4868f27069f8c
parentwg-quick: configurable search paths (diff)
downloadandroid_kernel_wireguard-a831aa82248009ba1ee95ac6ebdbeb5234aaffea.tar.xz
android_kernel_wireguard-a831aa82248009ba1ee95ac6ebdbeb5234aaffea.zip
wg-quick: get proper command output status
-rw-r--r--wg-quick.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/wg-quick.c b/wg-quick.c
index f34c089..db744d3 100644
--- a/wg-quick.c
+++ b/wg-quick.c
@@ -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);
}