>Number: 152673
>Category: bin
>Synopsis: [patch] find(1): correctly find empty dirs.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Nov 29 14:20:12 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Denise H. G.
>Release: FreeBSD 8.2-PRERELEASE amd64
>Organization:
XBSD Networks
>Environment:
System: FreeBSD pluton.xbsd.name 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #0: Mon
Nov 29 08:41:06 CST 2010
[email protected]:/opt/obj/sysbld/usr/src/sys/pluton-amd64 amd64
>Description:
While searching for empty directories, find(1) quits if it encounters
the first dir it can't descend into. However, it is supposed to print out an
warning message and continue with the rest of the file hierachy.
>How-To-Repeat:
As a non-privileged user, execute:
find /var -type d -empty
>Fix:
--- function.c.diff begins here ---
--- usr.bin/find/function.c.orig 2010-11-29 21:44:30.451542259 +0800
+++ usr.bin/find/function.c 2010-11-29 21:49:24.670933099 +0800
@@ -559,8 +559,10 @@
empty = 1;
dir = opendir(entry->fts_accpath);
- if (dir == NULL)
- err(1, "%s", entry->fts_accpath);
+ if (dir == NULL) {
+ warn("%s", entry->fts_accpath);
+ return 0;
+ }
for (dp = readdir(dir); dp; dp = readdir(dir))
if (dp->d_name[0] != '.' ||
(dp->d_name[1] != '\0' &&
--- function.c.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"