mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
Terminal+HackStudio: Fix leaking PTM fd to child processes
The pseudoterminal *master* fd is not supposed to be inherited, so make sure to open it with O_CLOEXEC.
This commit is contained in:
parent
bf012ca10a
commit
d3504b4f9b
2 changed files with 2 additions and 2 deletions
|
@ -148,7 +148,7 @@ int main(int argc, char** argv)
|
||||||
if (chdir(get_current_user_home_path().characters()) < 0)
|
if (chdir(get_current_user_home_path().characters()) < 0)
|
||||||
perror("chdir");
|
perror("chdir");
|
||||||
|
|
||||||
int ptm_fd = open("/dev/ptmx", O_RDWR);
|
int ptm_fd = open("/dev/ptmx", O_RDWR | O_CLOEXEC);
|
||||||
if (ptm_fd < 0) {
|
if (ptm_fd < 0) {
|
||||||
perror("open(ptmx)");
|
perror("open(ptmx)");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -24,7 +24,7 @@ void TerminalWrapper::run_command(const String& command)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ptm_fd = open("/dev/ptmx", O_RDWR);
|
int ptm_fd = open("/dev/ptmx", O_RDWR | O_CLOEXEC);
|
||||||
if (ptm_fd < 0) {
|
if (ptm_fd < 0) {
|
||||||
perror("open(ptmx)");
|
perror("open(ptmx)");
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue