From 5f4c3fa8c992a73cf3a590bb05e0fcfe882394cd Mon Sep 17 00:00:00 2001 From: millert Date: Tue, 16 Mar 2004 00:40:34 +0000 Subject: POSIX specifies that in directory mode device special files and FIFOs shall be skipped. Other types of files may be skipped too (this is implementation-dependent). In directory mode, just skip anything that is not a regular file or directory. OK tedu@ --- usr.bin/diff/diffdir.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'usr.bin/diff/diffdir.c') diff --git a/usr.bin/diff/diffdir.c b/usr.bin/diff/diffdir.c index 3223c75770d..bf2b3f01ff5 100644 --- a/usr.bin/diff/diffdir.c +++ b/usr.bin/diff/diffdir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diffdir.c,v 1.26 2003/11/09 20:13:57 otto Exp $ */ +/* $OpenBSD: diffdir.c,v 1.27 2004/03/16 00:40:34 millert Exp $ */ /* * Copyright (c) 2003 Todd C. Miller @@ -21,7 +21,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: diffdir.c,v 1.26 2003/11/09 20:13:57 otto Exp $"; +static const char rcsid[] = "$OpenBSD: diffdir.c,v 1.27 2004/03/16 00:40:34 millert Exp $"; #endif /* not lint */ #include @@ -283,7 +283,12 @@ diffit(struct dirent *dp, char *path1, size_t plen1, char *path2, size_t plen2) path1, path2); return; } - dp->d_status = diffreg(path1, path2, flags); + if (!S_ISREG(stb1.st_mode) && !S_ISDIR(stb1.st_mode)) + dp->d_status = D_SKIPPED1; + else if (!S_ISREG(stb2.st_mode) && !S_ISDIR(stb2.st_mode)) + dp->d_status = D_SKIPPED2; + else + dp->d_status = diffreg(path1, path2, flags); if (!lflag) print_status(dp->d_status, path1, path2, NULL); } -- cgit v1.2.3-59-g8ed1b