Commit 3f21041b95f7239bd5770c9c56a02264ba32430d
Close duplicated descriptors in bg_run_and_capture
_dup2() doesn't close source descriptors, so they were piling up
(without doing any harm, apparently).
Author: xaizek
Author date (UTC): 2026-11-15 18:52
Committer name: xaizek
Committer date (UTC): 2026-11-15 18:52
Parent(s): bcc04efee0c980842ca2b012ce35e7f9bd6c1205
Signing key: 99DC5E4DB05F6BE2
Tree: d65bc7505b0bf8ebed01a7ab0b20c93014e409ac
| File src/background.c changed (mode: 100644) (index 44cbb8e89..d83211f8d) |
| ... |
... |
bg_run_and_capture(char cmd[], int user_sh, FILE *in, FILE **out, FILE **err) |
| 934 |
934 |
_dup2(out_fd, _fileno(stdout)); |
_dup2(out_fd, _fileno(stdout)); |
| 935 |
935 |
_dup2(err_fd, _fileno(stderr)); |
_dup2(err_fd, _fileno(stderr)); |
| 936 |
936 |
|
|
|
937 |
|
close(in_fd); |
|
938 |
|
close(out_fd); |
|
939 |
|
close(err_fd); |
|
940 |
|
|
| 937 |
941 |
if(pid == (pid_t)-1) |
if(pid == (pid_t)-1) |
| 938 |
942 |
{ |
{ |
| 939 |
943 |
if(out != NULL) |
if(out != NULL) |