[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hurd-bug
Subject:    [PATCH 3/8] initscripts: use pidof -s /sbin/init for robustness
From:       Justus Winter <4winter () informatik ! uni-hamburg ! de>
Date:       2013-07-09 8:46:46
Message-ID: 1373359611-16879-4-git-send-email-4winter () informatik ! uni-hamburg ! de
[Download RAW message or body]

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 <rleigh@debian.org>  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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic