From: Russ Allbery Date: Tue, 4 May 2010 23:26:15 +0000 (-0700) Subject: Check if AFS is mounted before killing processes with open files X-Git-Tag: debian/1.5.74.1-1~5 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=44dac8eac6aa5bd5eb3311af1e510121c2584770;p=packages%2Fo%2Fopenafs.git Check if AFS is mounted before killing processes with open files * Skip killing processes with files open in AFS if AFS does not appear to be mounted according to /etc/mtab. Otherwise, we may call lsof without a specific mount point and kill far more processes than we intend to. (This code is disabled by default, so this problem would only be seen by people who enabled it.) --- diff --git a/debian/openafs-client.init b/debian/openafs-client.init index 6ad150da9..02de249b5 100755 --- a/debian/openafs-client.init +++ b/debian/openafs-client.init @@ -178,10 +178,12 @@ start_client() { kill_afs() { signal=$1 mount=`grep ^'AFS ' /etc/mtab | awk '{ print $2 }'` - pids=`/usr/bin/lsof -Fp $mount | sed 's/p//'` - if [ -n "$pids" ] ; then - kill -$signal $pids > /dev/null 2>&1 - sleep 1 + if [ -n "$mount" ] ; then + pids=`/usr/bin/lsof -Fp $mount | sed 's/p//'` + if [ -n "$pids" ] ; then + kill -$signal $pids > /dev/null 2>&1 + sleep 1 + fi fi }