comparison svr-chansession.c @ 364:90cb290836de channel-fix

Passes most test cases now
author Matt Johnston <matt@ucc.asn.au>
date Mon, 09 Oct 2006 16:31:00 +0000
parents 1c7bf9cec6c8
children a5bca950120d
comparison
equal deleted inserted replaced
363:6ba2894ec8d5 364:90cb290836de
63 63
64 64
65 /* required to clear environment */ 65 /* required to clear environment */
66 extern char** environ; 66 extern char** environ;
67 67
68 static int sesscheckclose(struct Channel *channel) {
69 struct ChanSess *chansess = (struct ChanSess*)channel->typedata;
70 return chansess->exit.exitpid != -1;
71 }
72
68 /* Handler for childs exiting, store the state for return to the client */ 73 /* Handler for childs exiting, store the state for return to the client */
69 74
70 /* There's a particular race we have to watch out for: if the forked child 75 /* There's a particular race we have to watch out for: if the forked child
71 * executes, exits, and this signal-handler is called, all before the parent 76 * executes, exits, and this signal-handler is called, all before the parent
72 * gets to run, then the childpids[] array won't have the pid in it. Hence we 77 * gets to run, then the childpids[] array won't have the pid in it. Hence we
960 965
961 const struct ChanType svrchansess = { 966 const struct ChanType svrchansess = {
962 0, /* sepfds */ 967 0, /* sepfds */
963 "session", /* name */ 968 "session", /* name */
964 newchansess, /* inithandler */ 969 newchansess, /* inithandler */
965 NULL, /* checkclosehandler */ 970 sesscheckclose, /* checkclosehandler */
966 chansessionrequest, /* reqhandler */ 971 chansessionrequest, /* reqhandler */
967 closechansess, /* closehandler */ 972 closechansess, /* closehandler */
968 }; 973 };
969 974
970 975