summaryrefslogtreecommitdiff
path: root/userland
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-06-25 19:20:03 +0200
committerAnton Kling <anton@kling.gg>2024-06-25 19:20:03 +0200
commitedac853e8935164113bda594865cd48c91893d11 (patch)
treeadcc40c27a658c7601c410f3e49fbc762544979b /userland
parent31743482bbdceeb2a0e52ae430ce1afad853e7e9 (diff)
VFS: dup2 fixes
Diffstat (limited to 'userland')
-rw-r--r--userland/windowserver/ws.c7
1 files changed, 4 insertions, 3 deletions
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);