diff mbox series

[v2] package/shairport-sync: fix init script (stop)

Message ID 20181220221838.21000-1-casantos@datacom.com.br
State Accepted
Commit 6568b939293e46718434e284bded04b746fbd80f
Headers show
Series [v2] package/shairport-sync: fix init script (stop) | expand

Commit Message

Carlos Santos Dec. 20, 2018, 10:18 p.m. UTC
shairport-sync creates its pidfile at /var/run/shairport-sync/, so pass
that path to start-stop-daemon in the stop operation.

Also pass the executable path, allowing start-stop-daemon to check if
the PID matches the shairport-sync process, preventing killing some
other inocent daemon.

Fixes:
  https://bugs.busybox.net/show_bug.cgi?id=11566

Reported-by: Bin Zhang <yangtze31@gmail.com>
Signed-off-by: Carlos Santos <casantos@datacom.com.br>
---
Changes v1->v2
  - Recreated patch with the PID checking part
---
 package/shairport-sync/S99shairport-sync | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Peter Korsgaard Dec. 21, 2018, 1:56 p.m. UTC | #1
>>>>> "Carlos" == Carlos Santos <casantos@datacom.com.br> writes:

 > shairport-sync creates its pidfile at /var/run/shairport-sync/, so pass
 > that path to start-stop-daemon in the stop operation.

 > Also pass the executable path, allowing start-stop-daemon to check if
 > the PID matches the shairport-sync process, preventing killing some
 > other inocent daemon.

 > Fixes:
 >   https://bugs.busybox.net/show_bug.cgi?id=11566

 > Reported-by: Bin Zhang <yangtze31@gmail.com>
 > Signed-off-by: Carlos Santos <casantos@datacom.com.br>

Committed, thanks.
Peter Korsgaard Jan. 1, 2019, 3:22 p.m. UTC | #2
>>>>> "Carlos" == Carlos Santos <casantos@datacom.com.br> writes:

 > shairport-sync creates its pidfile at /var/run/shairport-sync/, so pass
 > that path to start-stop-daemon in the stop operation.

 > Also pass the executable path, allowing start-stop-daemon to check if
 > the PID matches the shairport-sync process, preventing killing some
 > other inocent daemon.

 > Fixes:
 >   https://bugs.busybox.net/show_bug.cgi?id=11566

 > Reported-by: Bin Zhang <yangtze31@gmail.com>
 > Signed-off-by: Carlos Santos <casantos@datacom.com.br>
 > ---
 > Changes v1->v2
 >   - Recreated patch with the PID checking part

Committed to 2018.02.x and 2018.11.x, thanks.
diff mbox series

Patch

diff --git a/package/shairport-sync/S99shairport-sync b/package/shairport-sync/S99shairport-sync
index 5443ed138c..80b2fddbc6 100644
--- a/package/shairport-sync/S99shairport-sync
+++ b/package/shairport-sync/S99shairport-sync
@@ -6,16 +6,18 @@  OPTIONS="-d"
 case "$1" in
     start)
 	printf "Starting shairport-sync: "
-	start-stop-daemon -S -q -p /var/run/shairport-sync.pid --exec /usr/bin/shairport-sync -- $OPTIONS
+	start-stop-daemon -S -q --exec /usr/bin/shairport-sync -- $OPTIONS
 	[ $? = 0 ] && echo "OK" || echo "FAIL"
 	;;
     stop)
 	printf "Stopping shairport-sync: "
-	start-stop-daemon -K -q -p /var/run/shairport-sync.pid
+	start-stop-daemon -K -q --exec /usr/bin/shairport-sync \
+		-p /var/run/shairport-sync/shairport-sync.pid
 	[ $? = 0 ] && echo "OK" || echo "FAIL"
 	;;
     restart)
 	$0 stop
+	sleep 1
 	$0 start
 	;;
     *)