summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2004-11-26 16:46:00 +0000
committerAlexander Larsson <alexl@src.gnome.org>2004-11-26 16:46:00 +0000
commit43e12b9f647797722ea70c90f8b376230f514950 (patch)
treea42fb06d30ccc519b34621599031b76fa5e7789e
parentce4d6d1cdd240da0bf7dbf443fb3638aca2d5bd9 (diff)
downloadgnome-keyring-43e12b9f647797722ea70c90f8b376230f514950.tar.gz
Added support for slaving lifetime to filedescriptor.
2004-11-26 Alexander Larsson <alexl@redhat.com> * gnome-keyring-daemon.c: (lifetime_slave_pipe_io), (main): Added support for slaving lifetime to filedescriptor.
-rw-r--r--ChangeLog5
-rw-r--r--INSTALL2
-rw-r--r--gnome-keyring-daemon.c28
3 files changed, 33 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index fdfa85e6..c8f397ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-11-26 Alexander Larsson <alexl@redhat.com>
+
+ * gnome-keyring-daemon.c: (lifetime_slave_pipe_io), (main):
+ Added support for slaving lifetime to filedescriptor.
+
2004-10-11 Roozbeh Pournader <roozbeh@farsiweb.info>
* configure.in:
diff --git a/INSTALL b/INSTALL
index 54caf7c1..a4b34144 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,4 +1,4 @@
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
diff --git a/gnome-keyring-daemon.c b/gnome-keyring-daemon.c
index 0861d91b..879974b5 100644
--- a/gnome-keyring-daemon.c
+++ b/gnome-keyring-daemon.c
@@ -2436,16 +2436,27 @@ close_stdinout (void)
close (fd);
}
+static gboolean
+lifetime_slave_pipe_io (GIOChannel *channel,
+ GIOCondition cond,
+ gpointer callback_data)
+{
+ cleanup_socket_dir ();
+ _exit (2);
+}
+
int
main (int argc, char *argv[])
{
const char *path;
+ char *fd_str;
+ int fd;
pid_t pid;
gboolean foreground;
gboolean daemon;
+ GIOChannel *channel;
int i;
-
if (!create_master_socket (&path)) {
exit (1);
}
@@ -2536,6 +2547,21 @@ main (int argc, char *argv[])
update_keyrings_from_disk ();
loop = g_main_loop_new (NULL, FALSE);
+
+ fd_str = getenv ("GNOME_KEYRING_LIFETIME_FD");
+ if (fd_str != NULL && fd_str[0] != 0) {
+ fd = atoi (fd_str);
+ if (fd != 0) {
+ channel = g_io_channel_unix_new (fd);
+ g_io_add_watch (channel,
+ G_IO_IN | G_IO_HUP,
+ lifetime_slave_pipe_io, NULL);
+ g_io_channel_unref (channel);
+ }
+
+ }
+
+
g_main_loop_run (loop);
cleanup_socket_dir ();