bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/8] initscripts: use pidof -s /sbin/init for robustness


From: Justus Winter
Subject: [PATCH 3/8] initscripts: use pidof -s /sbin/init for robustness
Date: Tue, 9 Jul 2013 10:46:46 +0200

pidof -s returns the first matching process. Since readdir(2) on
procfs returns the processes in ascending order, this returns the
first process. This is more robust if there is more than one
/sbin/init process.

Currently on Hurd there are two /sbin/init processes. Clearly this
needs some investigation. But as far as I can tell this could also
happen if INITDEBUG is defined as /sbin/init then forks a child that
can be ptrace(2)d on a vanilla Linux kernel.
---
 debian/changelog                              |    1 +
 debian/src/initscripts/etc/init.d/mountall.sh |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 1ff8750..7d9aa05 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -53,6 +53,7 @@ sysvinit (2.88dsf-42) UNRELEASED; urgency=low
   [ Justus Winter ]
   * mount-functions.sh: Hurd has a tmpfs translator now, remove workaround.
   * mount-functions.sh: Add -ocompatible to procfs mounts on Hurd.
+  * mountall.sh: Use pidof -s /sbin/init for robustness.
 
  -- Roger Leigh <address@hidden>  Sat, 04 May 2013 13:13:51 +0100
 
diff --git a/debian/src/initscripts/etc/init.d/mountall.sh 
b/debian/src/initscripts/etc/init.d/mountall.sh
index 5f913cd..392eeec 100755
--- a/debian/src/initscripts/etc/init.d/mountall.sh
+++ b/debian/src/initscripts/etc/init.d/mountall.sh
@@ -55,7 +55,7 @@ do_start() {
                mknod -m 600 "$INITCTL" p
 
                # Reopen control channel.
-               PID="$(pidof /sbin/init || echo 1)"
+               PID="$(pidof -s /sbin/init || echo 1)"
                [ -n "$PID" ] && kill -s USR1 "$PID"
        fi
 
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]