From edac853e8935164113bda594865cd48c91893d11 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Tue, 25 Jun 2024 19:20:03 +0200 Subject: VFS: dup2 fixes --- userland/windowserver/ws.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'userland') diff --git a/userland/windowserver/ws.c b/userland/windowserver/ws.c index 7a1b7d6..ff341a0 100644 --- a/userland/windowserver/ws.c +++ b/userland/windowserver/ws.c @@ -686,13 +686,14 @@ void draw(void) { } int main(void) { - open("/dev/serial", O_WRITE, 0); - open("/dev/serial", O_WRITE, 0); + int serial_fd = open("/dev/serial", O_WRITE, 0); + dup2(serial_fd, 1); + serial_fd = 1; // Start a terminal by default. This is just to make it easier for me // to test the system. int pid = fork(); if (0 == pid) { - // TODO: Close (almost) all file descriptors from parent + close(serial_fd); char *argv[] = {"/term", NULL}; execv("/term", argv); assert(0); -- cgit v1.2.3