On Mon, Jul 15, 2013 at 7:11 PM, Allan McRae <[email protected]> wrote: > On 16/07/13 04:32, Dan McGee wrote: >> When calling open(), use O_CLOEXEC as much as possible to ensure the >> file descriptor is closed when and if a process using libalpm forks. >> >> For most of these cases, and especially in utility functions, the file >> descriptor is opened and closed in the same function, so we don't have >> too much to worry about. However, for things like the log file and >> database lock file, we should ensure descriptors aren't left hanging >> around for children to touch. >> >> This patch is inspired by the problem in FS#36161, where an open file >> descriptor to the current working directory prevents chroot() from >> working on FreeBSD. We don't need this file descriptor in the child >> process, so open it (and now several others) with O_CLOEXEC. >> >> Signed-off-by: Dan McGee <[email protected]> >> --- > > Compile error: > > CC libalpm_la-log.lo > In file included from /usr/include/fcntl.h:296:0, > from util.h:41, > from <command-line>:27: > In function 'open', > inlined from 'alpm_logaction' at <command-line>:52:3: > /usr/include/bits/fcntl2.h:50:24: error: call to '__open_missing_mode' > declared with attribute error: open with O_CREAT in second argument > needs 3 arguments > __open_missing_mode (); > ^
I just saw this too, was compiling with clang earlier and it doesn't warn on this. Weird! I'll submit an updated version later tonight. -Dan
