version 1.295, 2007/01/03 03:01:40 |
version 1.296, 2007/06/12 11:11:08 |
|
|
|
|
/* Stick around until the controlee closes the client_fd */ |
/* Stick around until the controlee closes the client_fd */ |
exitval = 0; |
exitval = 0; |
for (;!control_client_terminate;) { |
for (i = 0; !control_client_terminate && i < (int)sizeof(exitval);) { |
r = read(sock, &exitval, sizeof(exitval)); |
r = read(sock, (char *)&exitval + i, sizeof(exitval) - i); |
if (r == 0) { |
if (r == 0) { |
debug2("Received EOF from master"); |
debug2("Received EOF from master"); |
break; |
break; |
} |
} |
if (r > 0) |
|
debug2("Received exit status from master %d", exitval); |
|
if (r == -1 && errno != EINTR) |
if (r == -1 && errno != EINTR) |
fatal("%s: read %s", __func__, strerror(errno)); |
fatal("%s: read %s", __func__, strerror(errno)); |
|
i += r; |
} |
} |
|
|
if (control_client_terminate) |
|
debug2("Exiting on signal %d", control_client_terminate); |
|
|
|
close(sock); |
close(sock); |
|
|
leave_raw_mode(); |
leave_raw_mode(); |
|
|
|
if (control_client_terminate) { |
|
debug2("Exiting on signal %d", control_client_terminate); |
|
exitval = 255; |
|
} else if (i < (int)sizeof(exitval)) { |
|
debug2("Control master terminated unexpectedly"); |
|
exitval = 255; |
|
} else |
|
debug2("Received exit status from master %d", exitval); |
|
|
if (tty_flag && options.log_level != SYSLOG_LEVEL_QUIET) |
if (tty_flag && options.log_level != SYSLOG_LEVEL_QUIET) |
fprintf(stderr, "Connection to master closed.\r\n"); |
fprintf(stderr, "Connection to master closed.\r\n"); |