gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r24243 - gnunet/src/fs


From: gnunet
Subject: [GNUnet-SVN] r24243 - gnunet/src/fs
Date: Tue, 9 Oct 2012 21:44:55 +0200

Author: grothoff
Date: 2012-10-09 21:44:55 +0200 (Tue, 09 Oct 2012)
New Revision: 24243

Modified:
   gnunet/src/fs/gnunet-helper-fs-publish.c
Log:
-install sigpipe handler

Modified: gnunet/src/fs/gnunet-helper-fs-publish.c
===================================================================
--- gnunet/src/fs/gnunet-helper-fs-publish.c    2012-10-09 19:35:35 UTC (rev 
24242)
+++ gnunet/src/fs/gnunet-helper-fs-publish.c    2012-10-09 19:44:55 UTC (rev 
24243)
@@ -402,7 +402,32 @@
 }
 
 
+#ifndef WINDOWS
 /**
+ * Install a signal handler to ignore SIGPIPE.
+ */
+static void
+ignore_sigpipe ()
+{
+  struct sigaction oldsig;
+  struct sigaction sig;
+
+  memset (&sig, 0, sizeof (struct sigaction));
+  sig.sa_handler = SIG_IGN;
+  sigemptyset (&sig.sa_mask);
+#ifdef SA_INTERRUPT
+  sig.sa_flags = SA_INTERRUPT;  /* SunOS */
+#else
+  sig.sa_flags = SA_RESTART;
+#endif
+  if (0 != sigaction (SIGPIPE, &sig, &oldsig))
+    fprintf (stderr,
+             "Failed to install SIGPIPE handler: %s\n", strerror (errno));
+}
+#endif
+
+
+/**
  * Main function of the helper process to extract meta data.
  *
  * @param argc should be 3
@@ -427,6 +452,8 @@
   /* Get utf-8-encoded arguments */
   if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
     return 5;
+#else
+  ignore_sigpipe ();
 #endif
 
   /* parse command line */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]