summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYclept Nemo <orbisvicis@gmail.com>2012-07-18 07:58:11 +0200
committerStef Walter <stefw@gnome.org>2012-07-18 08:00:32 +0200
commit26a694b1a18a92580d211ec2d18803af0ad05d99 (patch)
treedbf7417279be6155f3e30e412f47597910bb893e
parentf61b94d12cb84a4929e19cde812f0a1423380b6a (diff)
downloadgnome-keyring-26a694b1a18a92580d211ec2d18803af0ad05d99.tar.gz
daemon: Use setsid() to become a process leader when daemonizing
* Fixes corner cases where people try to use gnome-keyring-daemon from the console. https://bugzilla.gnome.org/show_bug.cgi?id=679892
-rw-r--r--daemon/gkd-main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/daemon/gkd-main.c b/daemon/gkd-main.c
index f081fb89..da71da79 100644
--- a/daemon/gkd-main.c
+++ b/daemon/gkd-main.c
@@ -679,6 +679,13 @@ fork_and_print_environment (void)
if (run_daemonized) {
+ /*
+ * Become session leader of a new session, process group leader of a new
+ * process group, and detach from the controlling TTY, so that SIGHUP is
+ * not sent to this process when the previous session leader dies
+ */
+ setsid ();
+
/* Double fork if need to daemonize properly */
pid = fork ();