Terminal & Expander: Replace exit() with _exit() in fork+exec failure path.
This is necessary to avoid destructors being called in the child, potentially messing up parent state.
This commit is contained in:
@@ -258,8 +258,8 @@ ExpanderThread::PipeCommand(int argc, const char** argv, int& in, int& out,
|
||||
// "load" command.
|
||||
execv(argv[0], (char *const *)argv);
|
||||
|
||||
// shouldn't return
|
||||
return -1;
|
||||
// shouldn't get here
|
||||
_exit(-1);
|
||||
}
|
||||
|
||||
// parent
|
||||
|
||||
@@ -432,7 +432,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
|
||||
snprintf(handshake.msg, sizeof(handshake.msg),
|
||||
"could not set session leader.");
|
||||
send_handshake_message(terminalThread, handshake);
|
||||
exit(1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
/* open slave pty */
|
||||
@@ -442,7 +442,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
|
||||
snprintf(handshake.msg, sizeof(handshake.msg),
|
||||
"can't open tty (%s).", ttyName);
|
||||
send_handshake_message(terminalThread, handshake);
|
||||
exit(1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
/* set signal default */
|
||||
@@ -487,7 +487,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
|
||||
snprintf(handshake.msg, sizeof(handshake.msg),
|
||||
"failed set terminal interface (TERMIOS).");
|
||||
send_handshake_message(terminalThread, handshake);
|
||||
exit(1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -503,7 +503,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
|
||||
snprintf(handshake.msg, sizeof(handshake.msg),
|
||||
"mismatch handshake.");
|
||||
send_handshake_message(terminalThread, handshake);
|
||||
exit(1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
struct winsize ws = { handshake.row, handshake.col };
|
||||
@@ -553,7 +553,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
|
||||
"-l", NULL);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user