diff options
author | Hans de Goede <hdegoede@redhat.com> | 2011-04-19 16:24:48 +0200 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2011-04-19 16:26:17 +0200 |
commit | 4564cbb59dd1d187e55af0f98d0086dad1cf72c6 (patch) | |
tree | 7d1ebfac2a626e2b460fb7f281055ef9b759056c | |
parent | 9bd22a5c99fa4f5bea621926dda3989e0030c281 (diff) |
vdagent: connect to vdagentd after daemonizing
Doing this before daemonizing leads to the vdagentd seeing the connection
from the pid of the mother, which may have exited by the time vdagent
asks consolekit GetSessionForUnixProcess for the pid, resulting in an error.
-rw-r--r-- | src/vdagent.c | 7 |
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); |