瀏覽代碼

Replace remaining "signal" by "sigaction"

See https://github.com/civetweb/civetweb/commit/b7678afb55f02143476bb1393fcda1c3ac0e1428#commitcomment-31526970
bel2125 6 年之前
父節點
當前提交
595f264b9d
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/civetweb.c

+ 6 - 2
src/civetweb.c

@@ -5950,6 +5950,8 @@ spawn_process(struct mg_connection *conn,
 			                fderr[1],
 			                strerror(ERRNO));
 		} else {
+			struct sigaction sa;
+
 			/* Keep stderr and stdout in two different pipes.
 			 * Stdout will be sent back to the client,
 			 * stderr should go into a server error log. */
@@ -5966,8 +5968,10 @@ spawn_process(struct mg_connection *conn,
 			 * values, with one exception of SIGCHLD. According to
 			 * POSIX.1-2001 and Linux's implementation, SIGCHLD's handler
 			 * will leave unchanged after exec if it was set to be ignored.
-			 * Restore it to default action. */
-			signal(SIGCHLD, SIG_DFL);
+			 * Restore it to default action. */		
+			memset(&sa, 0, sizeof(sa));
+			sa.sa_handler = SIG_DFL;
+			sigaction(SIGCHLD, &sa, NULL);
 
 			interp = conn->dom_ctx->config[CGI_INTERPRETER];
 			if (interp == NULL) {