From 11bc606ed6685daa45a2dfe49d08ea2c36ceaf1f Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 31 Dec 2008 18:03:10 +0000 Subject: fixed useless malloc for dev_t --- src/uanytun.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/uanytun.c') 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); -- cgit v1.2.3