commit a15cb1e20e165caf936319f9cdfb86f57effdfa6
parent bda7b311745d0fb515f345e47b5e54b04a77cfc9
Author: Devin J. Pohly <djpohly@gmail.com>
Date: Tue, 15 Feb 2022 14:04:25 -0600
Merge pull request #160 from Humm42/closepipes
-s: close unused fds
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/dwl.c b/dwl.c
@@ -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 */