[Bug 931584] Re: Upstart should close all non-standard fds before starting a job
James Hunt
931584 at bugs.launchpad.net
Wed Feb 15 11:31:58 UTC 2012
I agree with Steve here: Upstart is careful to set CLOEXEC on all the
fds it has control over, so I would much prefer this be fixed at source.
A temporary work-around for jobs that are affected by this issue is to
add the following code at the top of all appropriate script sections -
remember that all script and exec sections run as different processes so
if you have a pre-start and a script section, the code below should be
added to the top of *both* those sections:
script
# close unexpectedly open fds
# The 'readlink' ensures we don't try to close the fd we're using to read the /proc/self/fd directory.
for fd in /proc/self/fd/*
do
fd=$(basename $fd)
case "$fd" in
0|1|2) ;;
*) readlink $fd && eval "exec $fd>&-" || :;;
esac
done
# << do something useful here >>
end script
--
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to openldap in Ubuntu.
https://bugs.launchpad.net/bugs/931584
Title:
Upstart should close all non-standard fds before starting a job
To manage notifications about this bug go to:
https://bugs.launchpad.net/upstart/+bug/931584/+subscriptions
More information about the Ubuntu-server-bugs
mailing list