changeset 29:7c5e5be876bb default/master

Small fix to error handling during initialization
author Ivo Smits <Ivo@UCIS.nl>
date Sat, 09 Apr 2011 23:34:06 +0200
parents e77af6acb559
children 6f0e6b7dc088
files src/common.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/common.c	Sat Apr 09 17:46:04 2011 +0200
+++ b/src/common.c	Sat Apr 09 23:34:06 2011 +0200
@@ -195,13 +195,13 @@
 	struct qtsession session;
 	session.protocol = *p;
 
-	init_udp(&session);
+	if (init_udp(&session) < 0) return -1;
 	int sfd = session.fd_socket;
 	if (sfd == -1) return -1;
 
-	session.fd_dev = init_tuntap();
-	int ttfd = session.fd_dev;
+	int ttfd = init_tuntap();
 	if (ttfd == -1) return -1;
+	session.fd_dev = ttfd;
 
 	char protocol_data[p->protocol_data_size];
 	memset(protocol_data, 0, p->protocol_data_size);