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.
This commit is contained in:
mlelstv 2024-01-26 07:10:04 +00:00
parent bdd835b785
commit ab1ad50d80
1 changed files with 10 additions and 6 deletions

View File

@ -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