[Yum-devel] [PATCH 09/10] Fix possible endless loop in yum-cron

Matthew Miller mattdm at mattdm.org
Fri Jul 29 02:00:17 UTC 2011


In the unlikely but possible case where LOCKDIR contained files _other_ than
the PIDFILE being tested for, rmdir wouldn't remove it, causing the lock to
persist and then rapidly be tested over and over as the script respawns.

Now uses rm -rf to zap the LOCKDIR (as is done at other points in the code).
---
 yum-cron/yum-cron.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/yum-cron/yum-cron.sh b/yum-cron/yum-cron.sh
index de1608e..d549471 100755
--- a/yum-cron/yum-cron.sh
+++ b/yum-cron/yum-cron.sh
@@ -71,7 +71,7 @@ else
   # happened.  We can't know the process name, so, clean up the old lockdir
   # and restart.
   if [[ ! -f $PIDFILE ]]; then
-    rmdir $LOCKDIR 2>/dev/null
+    rm -rf "${LOCKDIR}"
     echo "yum-cron: no lock PID, clearing and restarting myself" >&2
     exec $0 "$@"
   fi
-- 
1.7.6



More information about the Yum-devel mailing list