less,klogd,syslogd,nc,tcpudp: exit on signal by killing itself, not exit(1)
*: minor shrink
This commit is contained in:
@ -43,7 +43,7 @@ static void save_state(void)
|
||||
xioctl(handle, TIOCGETD, &saved_disc);
|
||||
}
|
||||
|
||||
static int set_termios_state_and_warn(struct termios *state)
|
||||
static int set_termios_state_or_warn(struct termios *state)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -78,12 +78,12 @@ static void restore_state_and_exit(int exitcode)
|
||||
memcpy(&state, &saved_state, sizeof(state));
|
||||
cfsetispeed(&state, B0);
|
||||
cfsetospeed(&state, B0);
|
||||
if (set_termios_state_and_warn(&state))
|
||||
if (set_termios_state_or_warn(&state))
|
||||
exitcode = 1;
|
||||
sleep(1);
|
||||
|
||||
/* Restore line status */
|
||||
if (set_termios_state_and_warn(&saved_state))
|
||||
if (set_termios_state_or_warn(&saved_state))
|
||||
exit(EXIT_FAILURE);
|
||||
if (ENABLE_FEATURE_CLEAN_UP)
|
||||
close(handle);
|
||||
@ -99,7 +99,7 @@ static void set_state(struct termios *state, int encap)
|
||||
int disc;
|
||||
|
||||
/* Set line status */
|
||||
if (set_termios_state_and_warn(state))
|
||||
if (set_termios_state_or_warn(state))
|
||||
goto bad;
|
||||
/* Set line discliple (N_SLIP always) */
|
||||
disc = N_SLIP;
|
||||
|
Reference in New Issue
Block a user