summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff/diffdir.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2004-03-16 00:40:34 +0000
committermillert <millert@openbsd.org>2004-03-16 00:40:34 +0000
commit5f4c3fa8c992a73cf3a590bb05e0fcfe882394cd (patch)
treef531dd735f940af417621b3f0eeb3a7893e008a1 /usr.bin/diff/diffdir.c
parentAnd two promise pciide, from chris@ (diff)
downloadwireguard-openbsd-5f4c3fa8c992a73cf3a590bb05e0fcfe882394cd.tar.xz
wireguard-openbsd-5f4c3fa8c992a73cf3a590bb05e0fcfe882394cd.zip
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@
Diffstat (limited to 'usr.bin/diff/diffdir.c')
-rw-r--r--usr.bin/diff/diffdir.c11
1 files changed, 8 insertions, 3 deletions
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 <Todd.Miller@courtesan.com>
@@ -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 <sys/param.h>
@@ -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);
}