bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bad leaks file fd to child processes


From: Koichi Murase
Subject: Re: Bad leaks file fd to child processes
Date: Mon, 28 Nov 2022 19:20:03 +0900

2022年11月28日(月) 19:06 Alexey via Bug reports for the GNU Bourne Again
SHell <bug-bash@gnu.org>:
> But we use the fact tat bash doesn't close FD for example to preliminary
> open log file for utility that we will `exec' later.
> Unfortunately bash doesn't provide any fcntl() mechanism to control FD
> flags.
> It'll be great to have  ability to manage CLOEXEC or any other FD flags
> from the script.

There is a loadable builtin `fdflags' to do that. If the loadable
builtin is installed (e.g. at /usr/lib/bash/fdflags), we can do
something like

enable -f /usr/lib/bash/fdflags fdflags
fdflags -s +cloexec <fd>

--
Koichi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]