Module Name:    src
Committed By:   mlelstv
Date:           Fri Jan 26 07:10:04 UTC 2024

Modified Files:
        src/bin/dd: args.c

Log Message:
Don't use the signal handler to terminate when nothing is to do (count=0, 
files=0).

The signal handler tries to raise the signal again, so that a parent can 
retrieve
the signal from the exit code. Calling the terminate handler with signal code 0
doesn't raise a signal and dd continues with exit(127) making this case an 
error.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/bin/dd/args.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/dd/args.c
diff -u src/bin/dd/args.c:1.42 src/bin/dd/args.c:1.43
--- src/bin/dd/args.c:1.42	Fri Jan 14 23:55:16 2022
+++ src/bin/dd/args.c	Fri Jan 26 07:10:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.42 2022/01/14 23:55:16 christos Exp $	*/
+/*	$NetBSD: args.c,v 1.43 2024/01/26 07:10:04 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)args.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: args.c,v 1.42 2022/01/14 23:55:16 christos Exp $");
+__RCSID("$NetBSD: args.c,v 1.43 2024/01/26 07:10:04 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -248,8 +248,10 @@ f_count(char *arg)
 {
 
 	cpy_cnt = strsuftoll("block count", arg, 0, LLONG_MAX);
-	if (!cpy_cnt)
-		terminate(0);
+	if (!cpy_cnt) {
+		summary();
+		exit(0);
+	}
 }
 
 static void
@@ -257,8 +259,10 @@ f_files(char *arg)
 {
 
 	files_cnt = (u_int)strsuftoll("file count", arg, 0, UINT_MAX);
-	if (!files_cnt)
-		terminate(0);
+	if (!files_cnt) {
+		summary();
+		exit(0);
+	}
 }
 
 static void

Reply via email to