comparison src/common.c @ 27:5ba185ca7102

Fixed error checking during initialization, restructured code a bit to make it even simpler
author Ivo Smits <Ivo@UCIS.nl>
date Sat, 09 Apr 2011 17:36:48 +0200
parents 38d495566d1c
children e77af6acb559
comparison
equal deleted inserted replaced
26:68c67c6d2080 27:5ba185ca7102
204 if (ttfd == -1) return -1; 204 if (ttfd == -1) return -1;
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); 209 if (p->init && p->init(&session) < 0) return -1;
210 210
211 fprintf(stderr, "The tunnel is now operational!\n"); 211 fprintf(stderr, "The tunnel is now operational!\n");
212 212
213 struct pollfd fds[2]; 213 struct pollfd fds[2];
214 fds[0].fd = ttfd; 214 fds[0].fd = ttfd;