pacman/lib/libalpm
Dan McGee 086bbc5b62 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>
2014-01-06 14:38:50 +10:00
..
po Update gitignore files for use with autoreconf 2013-07-22 13:27:23 +10:00
.gitignore libalpm: add pkg-config file 2012-04-25 20:02:36 -04:00
Makefile.am Remove -fgnu89-inline from compile options 2014-01-06 14:38:50 +10:00
add.c Use O_CLOEXEC as much as possible when opening files 2014-01-06 14:38:50 +10:00
add.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
alpm.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
alpm.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
alpm_list.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
alpm_list.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
backup.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
backup.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
base64.c Use 32-bit wide integer type in PolarSSL code 2012-01-07 11:27:41 -06:00
base64.h base64: don't compile base64_encode() function 2011-10-17 12:03:02 -05:00
be_local.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
be_package.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
be_sync.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
conflict.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
conflict.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
db.c Log more in search debug message 2014-01-06 14:38:50 +10:00
db.h Clear up definition of INFRQ_ALL 2014-01-06 14:38:50 +10:00
delta.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
delta.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
deps.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
deps.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
diskspace.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
diskspace.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
dload.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
dload.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
error.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
filelist.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
filelist.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
graph.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
graph.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
group.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
group.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
handle.c Use O_CLOEXEC as much as possible when opening files 2014-01-06 14:38:50 +10:00
handle.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
libalpm.pc.in Use libalpm version in pkg-config file 2013-04-26 12:43:53 +10:00
libarchive-compat.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
log.c Use O_CLOEXEC as much as possible when opening files 2014-01-06 14:38:50 +10:00
log.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
md5.c Use 32-bit wide integer type in PolarSSL code 2012-01-07 11:27:41 -06:00
md5.h Update MD5 routines with changes from PolarSSL 2011-08-11 20:17:21 -05:00
package.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
package.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
pkghash.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
pkghash.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
rawstr.c include util.h in rawstr.c 2011-07-05 22:36:40 -05:00
remove.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
remove.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
sha2.c Use 32-bit wide integer type in PolarSSL code 2012-01-07 11:27:41 -06:00
sha2.h Add sha2 (sha256) routines from PolarSSL 2011-08-15 07:07:13 -05:00
signing.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
signing.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
sync.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
sync.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
trans.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00
trans.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
util-common.c Split common utility functions for libalpm and pacman 2013-01-04 21:49:37 +10:00
util-common.h Split common utility functions for libalpm and pacman 2013-01-04 21:49:37 +10:00
util.c Use O_CLOEXEC as much as possible when opening files 2014-01-06 14:38:50 +10:00
util.h Update copyright years for 2014 2014-01-06 14:38:50 +10:00
version.c Update copyright years for 2014 2014-01-06 14:38:50 +10:00