summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vdagent.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/vdagent.c b/src/vdagent.c
index 2a72adb..3569cdb 100644
--- a/src/vdagent.c
+++ b/src/vdagent.c
@@ -106,7 +106,6 @@ void daemonize(void)
fprintf(logfile, "fork: %s\n", strerror(errno));
retval = 1;
default:
- udscs_destroy_connection(&client);
if (logfile != stderr)
fclose(logfile);
exit(retval);
@@ -166,6 +165,9 @@ int main(int argc, char *argv[])
fprintf(stderr, "Could not get home directory, logging to stderr\n");
}
+ if (do_daemonize)
+ daemonize();
+
client = udscs_connect(VDAGENTD_SOCKET, daemon_read_complete, NULL,
vdagentd_messages, VDAGENTD_NO_MESSAGES,
verbose? logfile:NULL, logfile);
@@ -175,9 +177,6 @@ int main(int argc, char *argv[])
return 1;
}
- if (do_daemonize)
- daemonize();
-
x11 = vdagent_x11_create(client, logfile, verbose);
if (!x11) {
udscs_destroy_connection(&client);