Make listen check before daemon fork
@@ -343,10 +343,6 @@ main(int argc, char **argv)
if (daemon)
{
/* start of daemonizing code */
- g_pid = g_fork();
-
- if (0 != g_pid)
- {
if (sesman_listen_test(g_cfg) != 0)
{
@@ -355,6 +351,9 @@ main(int argc, char **argv)
g_deinit();
g_exit(1);
}
+
+ if (0 != g_fork())
+ {
g_deinit();
g_exit(0);
}
