[upstart/f14/master] send close fd command to shell first (#646894)
Petr Lautrbach
plautrba at fedoraproject.org
Tue Oct 26 15:53:15 UTC 2010
commit b6672ef44457609c0a111c1bb9be357a8258987a
Author: Petr Lautrbach <plautrba at redhat.com>
Date: Tue Oct 26 17:35:41 2010 +0200
send close fd command to shell first (#646894)
upstart-close-fd.patch | 23 +++++++++++++++++++++++
upstart.spec | 3 +++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/upstart-close-fd.patch b/upstart-close-fd.patch
new file mode 100644
index 0000000..04391d1
--- /dev/null
+++ b/upstart-close-fd.patch
@@ -0,0 +1,23 @@
+diff --git a/init/job_process.c b/init/job_process.c
+index 8ce2f72..c2c96cb 100644
+--- a/init/job_process.c
++++ b/init/job_process.c
+@@ -298,6 +298,7 @@ job_process_run (Job *job,
+
+ /* Feed the script to the child process */
+ if (shell) {
++ nih_local char *cmd = NULL;
+ NihIo *io;
+
+ /* Clean up and close the reading end (we don't need it) */
+@@ -317,6 +318,10 @@ job_process_run (Job *job,
+ nih_free (err);
+ }
+
++ /* Close leaking fd first */
++ cmd = NIH_MUST (nih_sprintf (NULL, "<&%d- ;", fds[0]));
++ NIH_ZERO (nih_io_write (io, cmd, strlen (cmd)));
++
+ NIH_ZERO (nih_io_write (io, script, strlen (script)));
+ nih_io_shutdown (io);
+ }
diff --git a/upstart.spec b/upstart.spec
index be1719c..b83596d 100644
--- a/upstart.spec
+++ b/upstart.spec
@@ -15,6 +15,8 @@ Patch3: upstart-utmp.patch
Patch4: upstart-reexec.patch
# shutdown exits with nonzero exitcode when fails
Patch5: upstart-shutdown-exitcode.patch
+# send close fd command to shell first (#646894)
+Patch6: upstart-close-fd.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gettext, audit-libs-devel, expat-devel
BuildRequires: dbus-devel >= 1:1.2.16, libnih-devel >= 1.0.1
@@ -46,6 +48,7 @@ Drop-in replacement for the System V init tools, provided by Upstart.
%patch3 -p1 -b .utmp
%patch4 -p1 -b .reexec
%patch5 -p1 -b .exitcode
+%patch6 -p1 -b .closefd
%build
%configure --sbindir=/sbin --libdir=/%{_lib}
More information about the scm-commits
mailing list