summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@redhat.com>2011-08-29 14:50:50 +0200
committerTomas Bzatek <tbzatek@redhat.com>2011-08-29 14:50:50 +0200
commit9dcde52c3e6b8164180cfe8a60896b6d5e1e8c97 (patch)
tree4e3b5b7a636805e24dbd4197e07dde10009b30c2
parentd48afc9cce04fb4aa0b2a45d81d5ce7c75ca954f (diff)
downloadgvfs-9dcde52c3e6b8164180cfe8a60896b6d5e1e8c97.tar.gz
Ignore SIGPIPE signals to avoid process termination on cancelled transfer
That way we would be able to properly get EPIPE when trying to write to a socket or pipe whose far end has been closed. This happens e.g. on file copy cancellation. Glib does similar thing on GSocket initialization. https://bugzilla.gnome.org/show_bug.cgi?id=649041
-rw-r--r--daemon/daemon-main.c6
-rw-r--r--daemon/main.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/daemon/daemon-main.c b/daemon/daemon-main.c
index bc533461..ef9025ce 100644
--- a/daemon/daemon-main.c
+++ b/daemon/daemon-main.c
@@ -68,6 +68,12 @@ daemon_init (void)
g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, log_debug, NULL);
+#ifdef SIGPIPE
+ /* Ignore SIGPIPE to avoid killing daemons on cancelled transfer *
+ * See https://bugzilla.gnome.org/show_bug.cgi?id=649041 *
+ */
+ signal (SIGPIPE, SIG_IGN);
+#endif
dbus_error_init (&derror);
connection = dbus_bus_get (DBUS_BUS_SESSION, &derror);
diff --git a/daemon/main.c b/daemon/main.c
index 757229d2..4703562d 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -54,6 +54,10 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE);
g_thread_init (NULL);
+
+#ifdef SIGPIPE
+ signal (SIGPIPE, SIG_IGN);
+#endif
g_set_application_name (_("GVFS Daemon"));
context = g_option_context_new ("");