diff options
author | Christian Pointner <equinox@anytun.org> | 2008-12-31 18:03:10 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2008-12-31 18:03:10 +0000 |
commit | 11bc606ed6685daa45a2dfe49d08ea2c36ceaf1f (patch) | |
tree | 2dae90bc1aa9f1ffded1e84406058a38ee731a45 /src/uanytun.c | |
parent | changed useless malloc for options_t (diff) |
fixed useless malloc for dev_t
Diffstat (limited to 'src/uanytun.c')
-rw-r--r-- | src/uanytun.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/uanytun.c b/src/uanytun.c index db42d5c..1d6e646 100644 --- a/src/uanytun.c +++ b/src/uanytun.c @@ -216,17 +216,17 @@ int main(int argc, char* argv[]) log_printf(NOTICE, "just started..."); - tun_device_t* dev; - tun_init(&dev, opt.dev_name_, opt.dev_type_, opt.ifconfig_param_local_, opt.ifconfig_param_remote_netmask_); - if(!dev) { + tun_device_t dev; + ret = tun_init(&dev, opt.dev_name_, opt.dev_type_, opt.ifconfig_param_local_, opt.ifconfig_param_remote_netmask_); + if(ret) { log_printf(ERR, "error on tun_init, exitting"); options_clear(&opt); - exit(-1); + exit(ret); } - log_printf(NOTICE, "dev of type '%s' opened, actual name is '%s'", tun_get_type_string(dev), dev->actual_name_); + log_printf(NOTICE, "dev of type '%s' opened, actual name is '%s'", tun_get_type_string(&dev), dev.actual_name_); if(opt.post_up_script_) { - int ret = exec_script(opt.post_up_script_, dev->actual_name_); + int ret = exec_script(opt.post_up_script_, dev.actual_name_); log_printf(NOTICE, "post-up script returned %d", ret); } @@ -273,7 +273,7 @@ int main(int argc, char* argv[]) fclose(pid_file); } - ret = main_loop(dev, sock, &opt); + ret = main_loop(&dev, sock, &opt); tun_close(&dev); udp_close(&sock); |