]> code.ossystems Code Review - openembedded-core.git/commitdiff
dbus: Fix pid file in dbus init script
authorAndy Ross <andy.ross@windriver.com>
Fri, 10 Aug 2012 19:00:41 +0000 (12:00 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 15 Aug 2012 13:25:50 +0000 (14:25 +0100)
The PIDFILE (/var/run/dbus/pid) referenced by /etc/init.d/dbus-1 did
not match the path (/var/run/messagebus.pid) configured in
/etc/dbus-1/system.conf, so the initscript could start the daemon, but
not stop it.  Also remove needless directory ownership logic
(dbus-daemon drops its pid file as root before calling setuid).

Signed-off-by: Andy Ross <andy.ross@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
meta/recipes-core/dbus/dbus-1.4.20/dbus-1.init
meta/recipes-core/dbus/dbus-1.5.12/dbus-1.init

index 4abc4cbf73a7bdd9d2de0d99b57c07c119f0f9ac..17b58ed18fd8dafa431a2e76a138038aeb80bdc8 100644 (file)
@@ -18,9 +18,8 @@ set -e
 
 DAEMON=/usr/bin/dbus-daemon
 NAME=dbus
-DAEMONUSER=messagebus
-PIDDIR=/var/run/dbus
-PIDFILE=$PIDDIR/pid
+DAEMONUSER=messagebus           # must match /etc/dbus-1/system.conf
+PIDFILE=/var/run/messagebus.pid # must match /etc/dbus-1/system.conf
 UUIDDIR=/var/lib/dbus
 DESC="system message bus"
 EVENTDIR=/etc/dbus-1/event.d
@@ -38,11 +37,7 @@ test "$ENABLED" != "0" || exit 0
 
 start_it_up()
 {
-  if [ ! -d $PIDDIR ]; then
-    mkdir -p $PIDDIR
-    chown $DAEMONUSER $PIDDIR
-    chgrp $DAEMONUSER $PIDDIR
-  fi
+  mkdir -p "`dirname $PIDFILE`"
   if [ -e $PIDFILE ]; then
     PIDDIR=/proc/$(cat $PIDFILE)
     if [ -d ${PIDDIR} -a  "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then 
index 4abc4cbf73a7bdd9d2de0d99b57c07c119f0f9ac..17b58ed18fd8dafa431a2e76a138038aeb80bdc8 100644 (file)
@@ -18,9 +18,8 @@ set -e
 
 DAEMON=/usr/bin/dbus-daemon
 NAME=dbus
-DAEMONUSER=messagebus
-PIDDIR=/var/run/dbus
-PIDFILE=$PIDDIR/pid
+DAEMONUSER=messagebus           # must match /etc/dbus-1/system.conf
+PIDFILE=/var/run/messagebus.pid # must match /etc/dbus-1/system.conf
 UUIDDIR=/var/lib/dbus
 DESC="system message bus"
 EVENTDIR=/etc/dbus-1/event.d
@@ -38,11 +37,7 @@ test "$ENABLED" != "0" || exit 0
 
 start_it_up()
 {
-  if [ ! -d $PIDDIR ]; then
-    mkdir -p $PIDDIR
-    chown $DAEMONUSER $PIDDIR
-    chgrp $DAEMONUSER $PIDDIR
-  fi
+  mkdir -p "`dirname $PIDFILE`"
   if [ -e $PIDFILE ]; then
     PIDDIR=/proc/$(cat $PIDFILE)
     if [ -d ${PIDDIR} -a  "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then