diff options
author | carlosg <carlosg> | 2006-11-30 00:10:25 +0000 |
---|---|---|
committer | carlosg <carlosg> | 2006-11-30 00:10:25 +0000 |
commit | 04d8b9ba0594a4479232dd367b27a16a0389a3c3 (patch) | |
tree | ea3cd8d8cdce79fd96d2fe40de5f733cc6981934 /dispatcher | |
parent | b392f28d7265474ec9ae1343fbd566920b629f60 (diff) |
2006-11-30 Carlos Garnacho <carlosg@gnome.org>
* dispatcher/dispatcher.c (daemonize): Oops, create the pid file if it
doesn't exist, also close unneeded file descriptors.
Diffstat (limited to 'dispatcher')
-rw-r--r-- | dispatcher/dispatcher.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/dispatcher/dispatcher.c b/dispatcher/dispatcher.c index 136f8c9..9fce383 100644 --- a/dispatcher/dispatcher.c +++ b/dispatcher/dispatcher.c @@ -202,12 +202,16 @@ daemonize (void) setsid (); - if ((pidfile_fd = open ("/var/run/system-tools-backends.pid", O_WRONLY)) != -1) + if ((pidfile_fd = open ("/var/run/system-tools-backends.pid", O_CREAT | O_WRONLY)) != -1) { str = g_strdup_printf ("%d", getpid ()); write (pidfile_fd, str, strlen (str)); g_free (str); + + close (pidfile_fd); } + + close (dev_null_fd); } } |