comparison svr-main.c @ 108:10f4d3319780

- added circular buffering for channels - added stderr support for the client - cleaned up a bunch of "unused" warnings, duplicated header definitions - added exit-status support for the client
author Matt Johnston <matt@ucc.asn.au>
date Thu, 26 Aug 2004 13:16:40 +0000
parents 72dc22f56858
children 775c6cbfe995
comparison
equal deleted inserted replaced
107:d3eb1fa8484e 108:10f4d3319780
121 121
122 int childsock; 122 int childsock;
123 pid_t childpid; 123 pid_t childpid;
124 int childpipe[2]; 124 int childpipe[2];
125 125
126 struct sigaction sa_chld;
127 /* fork */ 126 /* fork */
128 if (svr_opts.forkbg) { 127 if (svr_opts.forkbg) {
129 int closefds = 0; 128 int closefds = 0;
130 #ifndef DEBUG_TRACE 129 #ifndef DEBUG_TRACE
131 if (!svr_opts.usingsyslog) { 130 if (!svr_opts.usingsyslog) {
301 } 300 }
302 #endif /* NON_INETD_MODE */ 301 #endif /* NON_INETD_MODE */
303 302
304 303
305 /* catch + reap zombie children */ 304 /* catch + reap zombie children */
306 static void sigchld_handler(int fish) { 305 static void sigchld_handler(int UNUSED(unused)) {
307 struct sigaction sa_chld; 306 struct sigaction sa_chld;
308 307
309 while(waitpid(-1, NULL, WNOHANG) > 0); 308 while(waitpid(-1, NULL, WNOHANG) > 0);
310 309
311 sa_chld.sa_handler = sigchld_handler; 310 sa_chld.sa_handler = sigchld_handler;
314 dropbear_exit("signal() error"); 313 dropbear_exit("signal() error");
315 } 314 }
316 } 315 }
317 316
318 /* catch any segvs */ 317 /* catch any segvs */
319 static void sigsegv_handler(int fish) { 318 static void sigsegv_handler(int UNUSED(unused)) {
320 fprintf(stderr, "Aiee, segfault! You should probably report " 319 fprintf(stderr, "Aiee, segfault! You should probably report "
321 "this as a bug to the developer\n"); 320 "this as a bug to the developer\n");
322 exit(EXIT_FAILURE); 321 exit(EXIT_FAILURE);
323 } 322 }
324 323
325 /* catch ctrl-c or sigterm */ 324 /* catch ctrl-c or sigterm */
326 static void sigintterm_handler(int fish) { 325 static void sigintterm_handler(int UNUSED(unused)) {
327 326
328 exitflag = 1; 327 exitflag = 1;
329 } 328 }
330 329
331 /* Things used by inetd and non-inetd modes */ 330 /* Things used by inetd and non-inetd modes */