--- usr.bin/diff/diff.h.orig 2021-01-06 05:22:41.672124000 +0000 +++ usr.bin/diff/diff.h 2021-01-06 05:34:02.134227000 +0000 @@ -83,6 +83,7 @@ #define D_MISMATCH2 4 /* path1 was a file, path2 a dir */ #define D_SKIPPED1 5 /* path1 was a special file */ #define D_SKIPPED2 6 /* path2 was a special file */ +#define D_ERROR 7 /* A file access error occurred */ struct excludes { char *pattern; --- usr.bin/diff/diff.c.orig 2021-01-06 05:22:41.672067000 +0000 +++ usr.bin/diff/diff.c 2021-01-06 05:35:11.308546000 +0000 @@ -511,6 +511,8 @@ printf("File %s%s is not a regular file or directory and was skipped\n", path2, entry); break; + case D_ERROR: + break; } } --- usr.bin/diff/diffreg.c.orig 2021-01-06 05:22:41.672285000 +0000 +++ usr.bin/diff/diffreg.c 2021-01-06 05:38:33.991406000 +0000 @@ -299,6 +299,7 @@ if ((f1 = opentemp(file1)) == NULL || fstat(fileno(f1), &stb1) == -1) { warn("%s", file1); + rval = D_ERROR; status |= 2; goto closem; } @@ -309,6 +310,7 @@ } if (f1 == NULL) { warn("%s", file1); + rval = D_ERROR; status |= 2; goto closem; } @@ -320,6 +322,7 @@ if ((f2 = opentemp(file2)) == NULL || fstat(fileno(f2), &stb2) == -1) { warn("%s", file2); + rval = D_ERROR; status |= 2; goto closem; } @@ -330,6 +333,7 @@ } if (f2 == NULL) { warn("%s", file2); + rval = D_ERROR; status |= 2; goto closem; } @@ -365,6 +369,7 @@ break; default: /* error */ + rval = D_ERROR; status |= 2; goto closem; }