Bladeren bron

test_get_response_cleanup: ignore SIGPIPE on Solaris

Evgeny Grin (Karlson2k) 8 jaren geleden
bovenliggende
commit
443d072f39
1 gewijzigde bestanden met toevoegingen van 10 en 0 verwijderingen
  1. 10 0
      src/testcurl/test_get_response_cleanup.c

+ 10 - 0
src/testcurl/test_get_response_cleanup.c

@@ -35,6 +35,9 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <fcntl.h>
+#ifdef __sun
+#include <signal.h>
+#endif /* __sun */
 
 #ifndef WINDOWS
 #include <sys/socket.h>
@@ -303,6 +306,13 @@ int
 main (int argc, char *const *argv)
 {
   unsigned int errorCount = 0;
+#ifdef __sun
+  struct sigaction act;
+
+  /* Solaris has no way to disable SIGPIPE on socket disconnect. */
+  act.sa_handler = SIG_IGN;
+  sigaction(SIGPIPE, &act, NULL);
+#endif /* __sun */
 
   oneone = (NULL != strrchr (argv[0], (int) '/')) ?
     (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0;