From 78a89e637c337e240678de3d1c0f1486b3affb93 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 13 Jan 2009 20:18:14 +0000 Subject: Check that /var/run/sshd.pid exists and that the process ID listed there corresponds to sshd before running '/etc/init.d/ssh reload' from if-up script; SIGHUP is racy if called at boot before sshd has a chance to install its signal handler, but fortunately the pid file is written after that which lets us avoid the race (closes: #502444). --- debian/openssh-server.if-up | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'debian/openssh-server.if-up') diff --git a/debian/openssh-server.if-up b/debian/openssh-server.if-up index c44a4d257..9b2140352 100644 --- a/debian/openssh-server.if-up +++ b/debian/openssh-server.if-up @@ -25,6 +25,11 @@ if [ ! -e /usr/sbin/sshd ]; then exit 0 fi +if [ ! -f /var/run/sshd.pid ] || \ + [ "$(ps -p "$(cat /var/run/sshd.pid)" -o comm=)" = sshd ]; then + exit 0 +fi + /etc/init.d/ssh reload >/dev/null 2>&1 || true exit 0 -- cgit v1.2.3