diff: diff regular files when -q is specified again

c30a321a61 accidentally modified the code paths when diffing regular
files to not diff them if `-q` was specified. Call `diffreg(..)` again,
regardless of whether or not `-q` was specified to restore the
functionality pre-c30a321a61ce, while only printing out the result to
the console if `-q` is not specified.

This change unbreaks diff so 2 files which differ are reported again via
the exit code when with `-q` is specified.

MFC after:	3 days
PR:		299643
Reviewed by:	des
Differential Revision: https://reviews.freebsd.org/D60910
Fixes: c30a321a61 ("diff: support -qq to output absolutely nothing")
This commit is contained in:
Enji Cooper committed 2026-10-20 10:40:47 -07:00
1 parent e8923c7346
commit ec1754a677
1 file changed
+3 -3
+3 -3
View File
@@ -139,7 +139,7 @@ main(int argc, char **argv)
{
const char *errstr;
char **oargv;
int ch, dflags, lastch, gotstdin, prevoptind, newarg;
int ch, dflags, error, lastch, gotstdin, prevoptind, newarg;
oargv = argv;
gotstdin = 0;
@@ -480,9 +480,9 @@ main(int argc, char **argv)
err(2, "%s", argv[1]);
}
error = diffreg(argv[0], argv[1], dflags, 1);
if (diff_format != D_QUIET)
print_status(diffreg(argv[0], argv[1], dflags, 1),
argv[0], argv[1], "");
print_status(error, argv[0], argv[1], "");
}
if (fflush(stdout) != 0)
err(2, "stdout");