summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-05-06 13:52:46 +0100
committerLinus Groh <mail@linusgroh.de>2021-05-06 13:52:46 +0100
commit53918364683d1110916f0533e921c00737cbadae (patch)
tree250e430c464632f09b9dba4d6f5f501551598cf8 /Userland/Applications
parente76342e242bcd9107189a79709b6b33d517e3ca5 (diff)
downloadserenity-53918364683d1110916f0533e921c00737cbadae.zip
LibC: Remove 'int* aslave' parameter from forkpty()
Only keep track of that (and eventually close() it) internally instead. This argument is not present on other systems, so we were running into compatibility issues with ports. Also bring the implementation closer to Linux and OpenBSD by making sure to close the slave pty fd in the fork()'d child as well as _exit()'ing on login_tty() failure - it's non-POSIX, so those are our references here. :^)
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/Terminal/main.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp
index 0292207769..191a0ada89 100644
--- a/Userland/Applications/Terminal/main.cpp
+++ b/Userland/Applications/Terminal/main.cpp
@@ -261,8 +261,8 @@ int main(int argc, char** argv)
RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("Terminal");
Core::File::ensure_parent_directories(config->filename());
- int ptm_fd, pts_fd;
- pid_t shell_pid = forkpty(&ptm_fd, &pts_fd, nullptr, nullptr, nullptr);
+ int ptm_fd;
+ pid_t shell_pid = forkpty(&ptm_fd, nullptr, nullptr, nullptr);
if (shell_pid < 0) {
perror("forkpty");
return 1;
@@ -276,8 +276,6 @@ int main(int argc, char** argv)
VERIFY_NOT_REACHED();
}
- close(pts_fd);
-
auto* pts_name = ptsname(ptm_fd);
utmp_update(pts_name, shell_pid, true);