[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1499:



Package: sysvinit
Version: 2.56-6

Problem Description:

   When I try to run "/etc/init.d/xdm stop" I get a usage statement.
   This is when xdm is already running.

   Most of the init.d scripts source the init.d/functions file which
   would normally be no problem but the first thing in the file is
   code to set the RUNLEVEL variables by using the set command.  This
   swallows any command line arguments for the script.

   The best way I can think of that does not cause editing of every
   file that includes init.d/functions is to make the code not use set
   to parse the output from /sbin/runlevel.  This can easily be done
   by making use of a local evaluation for a function call.  Also the
   if statement around the assignment is not needed since the :=
   operator does that logic on a per variable basis.

Here is a tested patch.

========== snip ====================
--- functions-orig	Sat Feb 25 16:20:35 1995
+++ functions	Wed Sep 27 17:57:57 1995
@@ -13,16 +13,13 @@
   export PATH="/sbin:/usr/sbin:/bin:/usr/bin"

   # Set RUNLEVEL and PREVLEVEL
-  if [ "$RUNLEVEL" = "" ]
-  then
-	levels=`runlevel`
-	if [ $? = 0 ]
-	then
-		eval set $levels
-		PREVLEVEL=$1
-		RUNLEVEL=$2
-	fi
-  fi
+  get_runlevel()
+  {
+    : ${PREVLEVEL:=$1}
+    : ${RUNLEVEL=$2}
+  }
+
+  get_runlevel `/sbin/runlevel`

   # A function to start a program.
   daemon() {
========== snip ====================

Hope this helps,
  Costa
--
  Constantine Rasmussen      508-750-7500 x7020     cdr@sme.siemens.com


Reply to: