Package: pgbouncer
Version: 1.4.2-1
Severity: important
Tags: patch

The "restart" action doesn't check the value of START so calling:

    $ /etc/init.d/pgbouncer restart

when START=0 will actually start the daemon (!).

Patch attached.

(Also, the initscript seems generally a bit crufty - calling "su",
sleeping instead of "start-stop-daemon --stop --retry", manual
"is_running" checks, etc etc.)


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org
       `-
diff --git a/debian/init b/debian/init
index 02aaa5d..e9acc7b 100644
--- a/debian/init
+++ b/debian/init
@@ -35,10 +35,14 @@ is_running() {
 
 
 d_start() {
-       if is_running; then
-               :
+        if [ ${START} -eq 1 ]; then
+               if is_running; then
+                       :
+               else
+                       su -c "$DAEMON $OPTS 2> /dev/null &" - postgres
+               fi
        else
-               su -c "$DAEMON $OPTS 2> /dev/null &" - postgres
+               log_warning_msg "pgbouncer daemon disabled in 
/etc/default/pgbouncer"
        fi
 }
 
@@ -62,13 +66,9 @@ d_stop() {
 
 case "$1" in
     start)
-        if [ ${START} -eq 1 ]; then
-               log_daemon_msg Starting pgbouncer
-               d_start
-               log_end_msg $?
-       else
-               log_warning_msg "pgbouncer daemon disabled in 
/etc/default/pgbouncer"
-       fi
+       log_daemon_msg Starting pgbouncer
+       d_start
+       log_end_msg $?
        ;;
     stop)
        log_daemon_msg Stopping pgbouncer

Attachment: signature.asc
Description: PGP signature

Reply via email to