]> git.ipfire.org Git - thirdparty/git.git/commit
run-command: add close_fd_above_stderr option
authorPaul Tarjan <github@paulisageek.com>
Wed, 15 Apr 2026 13:27:33 +0000 (13:27 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Apr 2026 15:44:33 +0000 (08:44 -0700)
commit50dc89cdfb6d8495853ceac4801c1cca9cd4ce38
treee957aa91df504ac65cf9ddd236fb0d4e7c9e7020
parentce48de8b2c85a4e5cbeb5dd1f2cfe042dd5392e4
run-command: add close_fd_above_stderr option

Add a close_fd_above_stderr flag to struct child_process.  When set,
the child closes file descriptors 3 and above between fork and exec
(skipping the child-notifier pipe), capped at sysconf(_SC_OPEN_MAX)
or 4096, whichever is smaller.  This prevents the child from
inheriting pipe endpoints or other descriptors from the parent
environment (e.g., the test harness).

Signed-off-by: Paul Tarjan <github@paulisageek.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
run-command.c
run-command.h