mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-16 00:05:40 +02:00
Don’t loop 65536 FDs, trying to close them, when fork+exec:ing
All FDs should now have the CLOEXEC flag set, and thus there’s no longer needed to manually loop “all” possible FDs and (trying to) close them. Note: the alsa module (alsalib, actually) is “racy” - while booting up, it temporarily opens the asoundrc file without CLOEXEC. If e.g. the script module starts its script inside this window, it’ll have a leaked FD. Not much we can do about it though :/ Closes #169
This commit is contained in:
parent
068c25d8f6
commit
fd014dc33b
3 changed files with 3 additions and 15 deletions
|
@ -458,16 +458,6 @@ execute_script(struct module *mod)
|
|||
close(comm_pipe[1]);
|
||||
comm_pipe[1] = -1;
|
||||
|
||||
/* Close *all* other FDs */
|
||||
for (int i = STDERR_FILENO + 1; i < 65536; i++) {
|
||||
if (i == exec_pipe[1]) {
|
||||
/* Needed for error reporting. Automatically closed
|
||||
* when execvp() succeeds */
|
||||
continue;
|
||||
}
|
||||
close(i);
|
||||
}
|
||||
|
||||
execvp(m->path, argv);
|
||||
|
||||
fail:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue