diff options
author | Dan McGee <dan@archlinux.org> | 2014-01-02 19:37:12 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-01-06 05:38:50 +0100 |
commit | 086bbc5b623d08df9ffe595bd5ee965e668a4ae1 (patch) | |
tree | 894ba4ccad5f33bb497329c1c75a8200b9109b09 /lib/libalpm/md5.c | |
parent | 8bec8a3f6a09155827aa8c3287f6d814c6912717 (diff) | |
download | pacman-086bbc5b623d08df9ffe595bd5ee965e668a4ae1.tar.gz pacman-086bbc5b623d08df9ffe595bd5ee965e668a4ae1.tar.xz |
Use O_CLOEXEC as much as possible when opening files
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 <dan@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/md5.c')
0 files changed, 0 insertions, 0 deletions