gvfs r1776 - in branches/gnome-2-22: . client



Author: hansp
Date: Wed May 21 21:34:31 2008
New Revision: 1776
URL: http://svn.gnome.org/viewvc/gvfs?rev=1776&view=rev

Log:
2008-05-22  Hans Petter Jansson  <hpj novell com>

	* client/gvfsfusedaemon.c (shutown_on_idle)
	(shutdown_signal)
	(vfs_init): When the process receives one of the HUP, TERM or
	INT signals, shut down gracefully. Fixes GNOME bug #531516.



Modified:
   branches/gnome-2-22/ChangeLog
   branches/gnome-2-22/client/gvfsfusedaemon.c

Modified: branches/gnome-2-22/client/gvfsfusedaemon.c
==============================================================================
--- branches/gnome-2-22/client/gvfsfusedaemon.c	(original)
+++ branches/gnome-2-22/client/gvfsfusedaemon.c	Wed May 21 21:34:31 2008
@@ -2051,6 +2051,18 @@
 	return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
+static gboolean
+shutdown_on_idle (void)
+{
+  fuse_exit (fuse_get_context ()->fuse);
+  return FALSE;
+}
+
+static void
+shutdown_signal (gint signum)
+{
+  g_idle_add ((GSourceFunc) shutdown_on_idle, NULL);
+}
 
 static gpointer
 vfs_init (struct fuse_conn_info *conn)
@@ -2104,6 +2116,11 @@
   volume_monitor = g_object_new (g_type_from_name ("GDaemonVolumeMonitor"), NULL);
   
   subthread_main_loop = g_main_loop_new (NULL, FALSE);
+
+  signal (SIGHUP, shutdown_signal);
+  signal (SIGTERM, shutdown_signal);
+  signal (SIGINT, shutdown_signal);
+
   subthread = g_thread_create ((GThreadFunc) subthread_main, NULL, FALSE, NULL);
 
   return NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]