[Openvas-commits] r5695 - in trunk/openvas-manager: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Oct 23 21:37:40 CEST 2009


Author: mattm
Date: 2009-10-23 21:37:38 +0200 (Fri, 23 Oct 2009)
New Revision: 5695

Modified:
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/src/openvasmd.c
Log:
	* src/openvasmd.c (accept_and_maybe_fork): Set SIGCHLD handler to
	SIG_DFL in child.
	(main): Revert SIGCHLD handler to SIG_IGN.

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-10-23 19:33:25 UTC (rev 5694)
+++ trunk/openvas-manager/ChangeLog	2009-10-23 19:37:38 UTC (rev 5695)
@@ -1,3 +1,9 @@
+2009-10-23  Matthew Mundell <matthew.mundell at intevation.de>
+
+	* src/openvasmd.c (accept_and_maybe_fork): Set SIGCHLD handler to
+	SIG_DFL in child.
+	(main): Revert SIGCHLD handler to SIG_IGN.
+
 2009-10-23  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
 
 	* src/omp.c (latex_header, latex_footer, print_report_latex):

Modified: trunk/openvas-manager/src/openvasmd.c
===================================================================
--- trunk/openvas-manager/src/openvasmd.c	2009-10-23 19:33:25 UTC (rev 5694)
+++ trunk/openvas-manager/src/openvasmd.c	2009-10-23 19:37:38 UTC (rev 5695)
@@ -388,6 +388,17 @@
         /* Child. */
         {
           is_parent = 0;
+
+          if (signal (SIGCHLD, SIG_DFL) == SIG_ERR)
+            {
+              g_critical ("%s: failed to set client SIGCHLD handler: %s\n",
+                          __FUNCTION__,
+                          strerror (errno));
+              shutdown (client_socket, SHUT_RDWR);
+              close (client_socket);
+              exit (EXIT_FAILURE);
+            }
+
 #endif /* FORK */
           // FIX get flags first
           /* The socket must have O_NONBLOCK set, in case an "asynchronous
@@ -880,16 +891,10 @@
 
   /* Warning from RATS heeded (signals now use small, separate handlers)
    * hence annotations. */
-  if (signal (SIGTERM, handle_sigterm) == SIG_ERR  /* RATS: ignore */
-      || signal (SIGINT, handle_sigint) == SIG_ERR /* RATS: ignore */
-      || signal (SIGHUP, handle_sighup) == SIG_ERR /* RATS: ignore */
-#if 0
-      /**
-       * @todo lsc_user_all_create needs this signal to get child return
-       *       statuses. */
-      || signal (SIGCHLD, SIG_IGN) == SIG_ERR     /* RATS: ignore */
-#endif
-      )
+  if (signal (SIGTERM, handle_sigterm) == SIG_ERR   /* RATS: ignore */
+      || signal (SIGINT, handle_sigint) == SIG_ERR  /* RATS: ignore */
+      || signal (SIGHUP, handle_sighup) == SIG_ERR  /* RATS: ignore */
+      || signal (SIGCHLD, SIG_IGN) == SIG_ERR)      /* RATS: ignore */
     {
       g_critical ("%s: failed to register signal handler\n", __FUNCTION__);
       exit (EXIT_FAILURE);



More information about the Openvas-commits mailing list