Mercurial > hg > quicktun
comparison src/common.c @ 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 |
comparison
equal
deleted
inserted
replaced
28:e77af6acb559 | 29:7c5e5be876bb |
---|---|
193 int qtrun(struct qtproto* p) { | 193 int qtrun(struct qtproto* p) { |
194 if (getconf("DEBUG")) debug = 1; | 194 if (getconf("DEBUG")) debug = 1; |
195 struct qtsession session; | 195 struct qtsession session; |
196 session.protocol = *p; | 196 session.protocol = *p; |
197 | 197 |
198 init_udp(&session); | 198 if (init_udp(&session) < 0) return -1; |
199 int sfd = session.fd_socket; | 199 int sfd = session.fd_socket; |
200 if (sfd == -1) return -1; | 200 if (sfd == -1) return -1; |
201 | 201 |
202 session.fd_dev = init_tuntap(); | 202 int ttfd = init_tuntap(); |
203 int ttfd = session.fd_dev; | |
204 if (ttfd == -1) return -1; | 203 if (ttfd == -1) return -1; |
204 session.fd_dev = ttfd; | |
205 | 205 |
206 char protocol_data[p->protocol_data_size]; | 206 char protocol_data[p->protocol_data_size]; |
207 memset(protocol_data, 0, p->protocol_data_size); | 207 memset(protocol_data, 0, p->protocol_data_size); |
208 session.protocol_data = &protocol_data; | 208 session.protocol_data = &protocol_data; |
209 if (p->init && p->init(&session) < 0) return -1; | 209 if (p->init && p->init(&session) < 0) return -1; |