瀏覽代碼

*** empty log message ***

François Pinard 30 年之前
父節點
當前提交
4156fce552
共有 1 個文件被更改,包括 24 次插入23 次删除
  1. 24 23
      src/buffer.c

+ 24 - 23
src/buffer.c

@@ -1130,30 +1130,31 @@ close_archive()
 			;
 
 		if (child != -1) {
-			switch (WTERMSIG(status)) {
-			case 0:
-				/* Child voluntarily terminated  -- but why? */
-				if (WEXITSTATUS(status) == MAGIC_STAT) {
-					exit(EX_SYSTEM);/* Child had trouble */
-				}
-				if (WEXITSTATUS(status) == (SIGPIPE + 128)) {
-					/*
-					 * /bin/sh returns this if its child
-					 * dies with SIGPIPE.  'Sok.
-					 */
-					break;
-				} else if (WEXITSTATUS(status))
-					msg("child returned status %d",
-						WEXITSTATUS(status));
-			case SIGPIPE:
-				break;		/* This is OK. */
-
-			default:
-				msg("child died with signal %d%s",
-				 WTERMSIG(status),
-				 WIFCOREDUMPED(status)? " (core dumped)": "");
+		  {
+		    if (WIFSIGNALED(status))
+		      {
+			/* SIGPIPE is OK, everything else is a problem. */
+			if (WTERMSIG (status) != SIGPIPE)
+			  msg("child died with signal %d%s", WTERMSIG(status),
+			      WIFCOREDUMPED(status)? " (core dumped)": "");
+		      }
+		    else
+		      {		      
+			/* Child voluntarily terminated  -- but why? */
+			if (WEXITSTATUS(status) == MAGIC_STAT) {
+			  exit(EX_SYSTEM);/* Child had trouble */
 			}
-		}
+			if (WEXITSTATUS(status) == (SIGPIPE + 128)) {
+			  /*
+			   * /bin/sh returns this if its child
+			   * dies with SIGPIPE.  'Sok.
+			   */
+			  break;
+			} else if (WEXITSTATUS(status))
+			  msg("child returned status %d",
+			      WEXITSTATUS(status));
+		      }
+		  }
 	}
 #endif	/* __MSDOS__ */
 }