Re: [hackers] [sbase][PATCH] flock: call exec without forking

From: NRK <nrk_AT_disroot.org>
Date: Sun, 6 Mar 2022 22:40:51 +0600

On Fri, Mar 04, 2022 at 01:11:00AM -0600, Arthur Williams wrote:
> Previously the code forked, waited for the child to exit and then
> returned the child's exit code. It is simpler to just skip fork and call
> exec directly.

Hi Arthur,

I didn't comment on this the last time, as I'm not entirely sure if this
is correct or not myself. However the flock(1) shipped with linux-utils
has a specific flag to avoid forking, the manpage states:

       -F, --no-fork
           Do not fork before executing command. Upon execution the flock
           process is replaced by command which continues to hold the lock.
           This option is incompatible with --close as there would otherwise
           be nothing left to hold the lock.

NOTE: `--close` is the `-o` flag.

- NRK
Received on Sun Mar 06 2022 - 17:40:51 CET

This archive was generated by hypermail 2.3.0 : Sun Mar 06 2022 - 17:48:45 CET