audit: make the first few fds close-on-exec
authorSimon McVittie <smcv@debian.org>
Wed, 19 Aug 2015 22:47:40 +0000 (23:47 +0100)
committerSimon McVittie <smcv@debian.org>
Tue, 25 Aug 2015 15:42:48 +0000 (16:42 +0100)
commit8142d161f6727f4d0ab42eed64e1ba1949ef77db
treefcbb974b220a559b13495b9afc52ce8e19694afe
parent0a0206d9a63333dada18a3db966b80e6940aa021
audit: make the first few fds close-on-exec

libcap-ng < 0.7.7 leaks one non-close-on-exec fd during initialization.
test-bus asserts that all fds beyond 2 passed to an executed subprocess
have the close-on-exec flag set, which will fail at that leaked fd.

This was unnoticed until commit 517c4685, because libaudit was
previously only initialized if we were configured to switch uid,
which the regression tests do not do; the system bus is normally
the only place that happens, but the system bus is not normally
run with the "embedded tests" enabled (since they are bad
for performance and security).

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=91684
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
bus/audit.c