Просмотр исходного кода

Merge trunk revision 2639:
r2639 | beekhof | 2009-12-15 04:52:48 -0700 (Tue, 15 Dec 2009) | 7 lines

Correctly determine current state in init script

If two stop actions are ever performed simultaneously, then neither will terminate.
With the default implementaiton of __pids_pidof, the status() function from
/etc/init.d/functions incorrectly thinks the other stop action is a real
corosync process.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/branches/flatiron@2687 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake 16 лет назад
Родитель
Сommit
b7ee142c68
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      init/generic.in

+ 9 - 0
init/generic.in

@@ -62,6 +62,15 @@ if [ -d @SYSCONFDIR@/default ]; then
 	[ -z "$LOCK_FILE" ] && LOCK_FILE="@LOCALSTATEDIR@/lock/$prog"
 fi
 
+# The version of __pids_pidof in /etc/init.d/functions calls pidof with -x
+# This means it matches scripts, including this one.
+# Redefine it here so that status (from the same file) works.
+# Otherwise simultaneous calls to stop() will loop forever
+__pids_pidof() {
+        pidof -c -o $$ -o $PPID -o %PPID "$1" || \
+                pidof -c -o $$ -o $PPID -o %PPID "${1##*/}"
+}
+
 start()
 {
 	echo -n "Starting $desc ($prog): "