diff options
author | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2011-04-21 01:14:22 +0000 |
---|---|---|
committer | Jacek Masiulaniec <jacekm@cvs.openbsd.org> | 2011-04-21 01:14:22 +0000 |
commit | 07f3d2f37336ab69e771c0f554497ae688a243c2 (patch) | |
tree | b01629dc5b74b1d2ab6566398b363af9e9b656c7 /usr.bin/find/find.c | |
parent | e1c4c272498607eec76f32d3a9e0a080ecb2ea95 (diff) |
find: return exit code 1 if any path could not be traversed
matches posix and the manual, ok millert
Diffstat (limited to 'usr.bin/find/find.c')
-rw-r--r-- | usr.bin/find/find.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/find/find.c b/usr.bin/find/find.c index edfd7a4a52b..09345aeae7c 100644 --- a/usr.bin/find/find.c +++ b/usr.bin/find/find.c @@ -1,4 +1,4 @@ -/* $OpenBSD: find.c,v 1.14 2009/10/27 23:59:38 deraadt Exp $ */ +/* $OpenBSD: find.c,v 1.15 2011/04/21 01:14:21 jacekm Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -143,12 +143,15 @@ FTS *tree; /* pointer to top of FTS hierarchy */ FTSENT *entry; /* shared with SIGINFO handler */ -void +int find_execute(PLAN *plan, /* search plan */ char **paths) /* array of pathnames to traverse */ { sigset_t fullset, oset; + int rval; PLAN *p; + + rval = 0; if (!(tree = fts_open(paths, ftsoptions, NULL))) err(1, "fts_open"); @@ -178,12 +181,14 @@ find_execute(PLAN *plan, /* search plan */ case FTS_NS: (void)fflush(stdout); warn("%s", entry->fts_path); + rval = 1; continue; } #define BADCH " \t\n\\'\"" if (isxargs && strpbrk(entry->fts_path, BADCH)) { (void)fflush(stdout); warnx("%s: illegal path", entry->fts_path); + rval = 1; continue; } @@ -196,4 +201,5 @@ find_execute(PLAN *plan, /* search plan */ ; } (void)fts_close(tree); + return (rval); } |