version 1.47, 2011/01/08 01:52:36 |
version 1.48, 2011/03/03 08:51:47 |
|
|
struct event client_event; |
struct event client_event; |
const char *client_exitmsg; |
const char *client_exitmsg; |
int client_exitval; |
int client_exitval; |
|
enum msgtype client_exittype; |
int client_attached; |
int client_attached; |
|
|
int client_connect(char *, int); |
int client_connect(char *, int); |
|
|
struct cmd_list *cmdlist; |
struct cmd_list *cmdlist; |
struct msg_command_data cmddata; |
struct msg_command_data cmddata; |
int cmdflags, fd; |
int cmdflags, fd; |
|
pid_t ppid; |
enum msgtype msg; |
enum msgtype msg; |
char *cause; |
char *cause; |
|
|
|
|
event_dispatch(); |
event_dispatch(); |
|
|
/* Print the exit message, if any, and exit. */ |
/* Print the exit message, if any, and exit. */ |
if (client_attached && client_exitmsg != NULL && !login_shell) |
if (client_attached) { |
printf("[%s]\n", client_exitmsg); |
if (client_exitmsg != NULL && !login_shell) |
|
printf("[%s]\n", client_exitmsg); |
|
|
|
ppid = getppid(); |
|
if (client_exittype == MSG_DETACHKILL && ppid > 1) |
|
kill(ppid, SIGHUP); |
|
} |
return (client_exitval); |
return (client_exitval); |
} |
} |
|
|
|
|
|
|
log_debug("client got %d", imsg.hdr.type); |
log_debug("client got %d", imsg.hdr.type); |
switch (imsg.hdr.type) { |
switch (imsg.hdr.type) { |
|
case MSG_DETACHKILL: |
case MSG_DETACH: |
case MSG_DETACH: |
if (datalen != 0) |
if (datalen != 0) |
fatalx("bad MSG_DETACH size"); |
fatalx("bad MSG_DETACH size"); |
|
|
|
client_exittype = imsg.hdr.type; |
|
if (imsg.hdr.type == MSG_DETACHKILL) |
|
client_exitmsg = "detached and SIGHUP"; |
|
else |
|
client_exitmsg = "detached"; |
client_write_server(MSG_EXITING, NULL, 0); |
client_write_server(MSG_EXITING, NULL, 0); |
client_exitmsg = "detached"; |
|
break; |
break; |
case MSG_EXIT: |
case MSG_EXIT: |
if (datalen != 0 && |
if (datalen != 0 && |