diff options
-rw-r--r-- | src/bsd/tun.c | 2 | ||||
-rw-r--r-- | src/linux/tun.c | 2 | ||||
-rw-r--r-- | src/sysexec.c | 6 | ||||
-rw-r--r-- | src/uanytun.c | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/bsd/tun.c b/src/bsd/tun.c index e2736ec..31ddd6c 100644 --- a/src/bsd/tun.c +++ b/src/bsd/tun.c @@ -335,7 +335,7 @@ void tun_do_ifconfig(tun_device_t* dev) return; } - char* const argv[] = { dev->actual_name_, dev->net_addr_, "netmask", dev->net_mask_, "mtu", mtu_str, end, NULL }; + char* const argv[] = { "/sbin/ifconfig", dev->actual_name_, dev->net_addr_, "netmask", dev->net_mask_, "mtu", mtu_str, end, NULL }; uanytun_exec("/sbin/ifconfig", argv, NULL); free(mtu_str); diff --git a/src/linux/tun.c b/src/linux/tun.c index e46e5ee..77f95fe 100644 --- a/src/linux/tun.c +++ b/src/linux/tun.c @@ -197,7 +197,7 @@ void tun_do_ifconfig(tun_device_t* dev) return; } - char* const argv[] = { dev->actual_name_, dev->net_addr_, "netmask", dev->net_mask_, "mtu", mtu_str, NULL }; + char* const argv[] = { "/sbin/ifconfig", dev->actual_name_, dev->net_addr_, "netmask", dev->net_mask_, "mtu", mtu_str, NULL }; uanytun_exec("/sbin/ifconfig", argv, NULL); free(mtu_str); diff --git a/src/sysexec.c b/src/sysexec.c index 2ef1d50..5cedbf7 100644 --- a/src/sysexec.c +++ b/src/sysexec.c @@ -65,9 +65,9 @@ int uanytun_exec(const char* script, char* const argv[], char* const evp[]) log_printf(WARNING, "can't open stderr"); } execve(script, argv, evp); - // if execl return, an error occurred - log_printf(ERROR, "error on executing script: %s", strerror(errno)); - return -1; + // if execve returns, an error occurred, but logging doesn't work + // because we closed all file descriptors, so just call exit + exit(-1); } int status = 0; waitpid(pid, &status, 0); diff --git a/src/uanytun.c b/src/uanytun.c index 7ce1871..9f5e8b2 100644 --- a/src/uanytun.c +++ b/src/uanytun.c @@ -401,7 +401,7 @@ int main(int argc, char* argv[]) if(opt.post_up_script_) { log_printf(NOTICE, "executing post-up script '%s'", opt.post_up_script_); - char* const argv[] = { dev.actual_name_, NULL }; + char* const argv[] = { opt.post_up_script_, dev.actual_name_, NULL }; int ret = uanytun_exec(opt.post_up_script_, argv, NULL); } |