Permalink
Browse files

Fix the wrong error message when multiple booth daemons being started.

This patch fixes the regression which was introduced by commit c93995e,
we move all of the initialization before daemonization happens, thus lost
the protection which was provided by lockfile(). So fix it now.

Reported-and-Tested-by: Yuich SEINO <seino.cluster2@gmail.com>
Signed-off-by: Jiaju Zhang <jjzhang@suse.de>
  • Loading branch information...
1 parent 03a34c6 commit 4b00d46480f45a205f2550ff0760c8b372009f7f @jjzhang committed Jun 20, 2012
Showing with 6 additions and 20 deletions.
  1. +6 −20 src/main.c
View
@@ -447,14 +447,12 @@ static int setup_timer(void)
return timerlist_init();
}
-static int setup(int type)
+static int loop(void)
{
- int rv;
-
- rv = setup_config(type);
- if (rv < 0)
- goto fail;
-
+ void (*workfn) (int ci);
+ void (*deadfn) (int ci);
+ int rv, i;
+
rv = setup_timer();
if (rv < 0)
goto fail;
@@ -472,18 +470,6 @@ static int setup(int type)
goto fail;
client_add(rv, process_listener, NULL);
- return 0;
-
-fail:
- return -1;
-}
-
-static int loop(void)
-{
- void (*workfn) (int ci);
- void (*deadfn) (int ci);
- int rv, i;
-
while (1) {
rv = poll(pollfd, client_maxi + 1, poll_timeout);
if (rv == -1 && errno == EINTR)
@@ -947,7 +933,7 @@ static int do_server(int type)
int fd = -1;
int rv = -1;
- rv = setup(type);
+ rv = setup_config(type);
if (rv < 0)
goto out;

0 comments on commit 4b00d46

Please sign in to comment.