[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27078 - libmicrohttpd/src/examples
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27078 - libmicrohttpd/src/examples |
Date: |
Thu, 9 May 2013 14:58:14 +0200 |
Author: grothoff
Date: 2013-05-09 14:58:14 +0200 (Thu, 09 May 2013)
New Revision: 27078
Modified:
libmicrohttpd/src/examples/demo.c
Log:
-handle SIGPIPE
Modified: libmicrohttpd/src/examples/demo.c
===================================================================
--- libmicrohttpd/src/examples/demo.c 2013-05-09 11:48:42 UTC (rev 27077)
+++ libmicrohttpd/src/examples/demo.c 2013-05-09 12:58:14 UTC (rev 27078)
@@ -781,7 +781,35 @@
}
+static void
+catcher (int sig)
+{
+}
+
+
/**
+ * setup handlers to ignore SIGPIPE.
+ */
+static void
+ignore_sigpipe ()
+{
+ struct sigaction oldsig;
+ struct sigaction sig;
+
+ sig.sa_handler = &catcher;
+ 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));
+}
+
+
+/**
* Entry point to demo. Note: this HTTP server will make all
* files in the current directory and its subdirectories available
* to anyone. Press ENTER to stop the server once it has started.
@@ -804,6 +832,7 @@
"%s PORT\n", argv[0]);
return 1;
}
+ ignore_sigpipe ();
magic = magic_open (MAGIC_MIME_TYPE);
(void) magic_load (magic, NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27078 - libmicrohttpd/src/examples,
gnunet <=