git-annex/Utility/LockFile
Joey Hess 033e4b086f
audit all openFd and dupping for close-on-exec
Made all uses of openFd and dup set the close-on-exec flag, with a few
exceptions when starting a git-annex daemon.

Made openFdWithMode be used everywhere, rather than openFd.
Adding a new parameter to it ensures I checked everything.
And will help to make sure this gets considered in the future when
opening fds.

In lockPidFile, the only thing that keeps the pid file locked, once
daemonize re-runs the command in a new session, is that the fd is
inherited.

In Utility.LogFile.redir, the new fd it dups to does not have the
close-on-exec flag set, because this is used to set up the stdout and
stderr fds, which need to be inherited by child processes.

Same in Assistant.startDaemon where the browser gets started with the
original stdout and stderr.

This does nothing about uses of openFile and similar!

Sponsored-By: mycroft
2025-09-04 16:01:41 -04:00
..
LockStatus.hs explict export lists 2019-11-21 16:08:37 -04:00
PidLock.hs audit all openFd and dupping for close-on-exec 2025-09-04 16:01:41 -04:00
Posix.hs audit all openFd and dupping for close-on-exec 2025-09-04 16:01:41 -04:00
Windows.hs OsPath transition Windows build fixes 2025-02-11 15:40:53 -04:00