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.
|
// "load" command.
|
||||||
execv(argv[0], (char *const *)argv);
|
execv(argv[0], (char *const *)argv);
|
||||||
|
|
||||||
// shouldn't return
|
// shouldn't get here
|
||||||
return -1;
|
_exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// parent
|
// parent
|
||||||
|
|||||||
@@ -432,7 +432,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
|
|||||||
snprintf(handshake.msg, sizeof(handshake.msg),
|
snprintf(handshake.msg, sizeof(handshake.msg),
|
||||||
"could not set session leader.");
|
"could not set session leader.");
|
||||||
send_handshake_message(terminalThread, handshake);
|
send_handshake_message(terminalThread, handshake);
|
||||||
exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open slave pty */
|
/* open slave pty */
|
||||||
@@ -442,7 +442,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
|
|||||||
snprintf(handshake.msg, sizeof(handshake.msg),
|
snprintf(handshake.msg, sizeof(handshake.msg),
|
||||||
"can't open tty (%s).", ttyName);
|
"can't open tty (%s).", ttyName);
|
||||||
send_handshake_message(terminalThread, handshake);
|
send_handshake_message(terminalThread, handshake);
|
||||||
exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set signal default */
|
/* set signal default */
|
||||||
@@ -487,7 +487,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
|
|||||||
snprintf(handshake.msg, sizeof(handshake.msg),
|
snprintf(handshake.msg, sizeof(handshake.msg),
|
||||||
"failed set terminal interface (TERMIOS).");
|
"failed set terminal interface (TERMIOS).");
|
||||||
send_handshake_message(terminalThread, handshake);
|
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),
|
snprintf(handshake.msg, sizeof(handshake.msg),
|
||||||
"mismatch handshake.");
|
"mismatch handshake.");
|
||||||
send_handshake_message(terminalThread, handshake);
|
send_handshake_message(terminalThread, handshake);
|
||||||
exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct winsize ws = { handshake.row, handshake.col };
|
struct winsize ws = { handshake.row, handshake.col };
|
||||||
@@ -553,7 +553,7 @@ Shell::_Spawn(int row, int col, const ShellParameters& parameters)
|
|||||||
"-l", NULL);
|
"-l", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user