Merge pull request #160 from Humm42/closepipes

-s: close unused fds
main
Devin J. Pohly 2022-02-15 14:04:25 -06:00 committed by GitHub
commit a15cb1e20e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

2
dwl.c
View File

@ -1827,11 +1827,13 @@ run(char *startup_cmd)
EBARF("startup: fork");
if (startup_pid == 0) {
dup2(piperw[0], STDIN_FILENO);
close(piperw[0]);
close(piperw[1]);
execl("/bin/sh", "/bin/sh", "-c", startup_cmd, NULL);
EBARF("startup: execl");
}
dup2(piperw[1], STDOUT_FILENO);
close(piperw[1]);
close(piperw[0]);
}
/* If nobody is reading the status output, don't terminate */