summaryrefslogtreecommitdiff
path: root/src/uanytun.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2008-12-30 06:23:03 +0000
committerChristian Pointner <equinox@anytun.org>2008-12-30 06:23:03 +0000
commit28fd39060f79afa6bdc0fe9c8018fc0b10164473 (patch)
tree05c9c10ecc37be4300cff8e1299aa0250a7e0d53 /src/uanytun.c
parentworks on OpenBSD now (but no support for UDPv6) (diff)
fixed some out of memory errors
options parser gives now a hint where the error happened added build instructions for OpenBSD to Readme
Diffstat (limited to 'src/uanytun.c')
-rw-r--r--src/uanytun.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/uanytun.c b/src/uanytun.c
index fa2a207..7c49934 100644
--- a/src/uanytun.c
+++ b/src/uanytun.c
@@ -179,16 +179,22 @@ int main(int argc, char* argv[])
log_init("uanytun", DAEMON);
signal_init();
- log_printf(NOTICE, "just started...");
-
options_t* opt;
int ret = options_parse(&opt, argc, argv);
if(ret) {
- options_print_usage();
- log_printf(ERR, "error on options_parse, exitting");
+ options_clear(&opt);
+ if(ret > 0)
+ fprintf(stderr, "syntax error near: %s\n\n", argv[ret]);
+ if(ret == -2)
+ fprintf(stderr, "memory error on options_parse, exitting\n");
+
+ if(ret == -1 || ret > 0)
+ options_print_usage();
+
exit(ret);
}
+ 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_);