summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1999-10-04 21:26:11 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1999-10-04 21:26:11 +0000
commitcd21bf5152aa75fa8a13091c4ba85f3c16b9d1a9 (patch)
treee6f48b3b45d808cce6667d154e978077b3834cbe /usr.bin
parent2a6b2af1a4a3f478bab7a2f06a5f2bd9b19155ca (diff)
If we can't chdir to the root dir in -execdir, just return instead
of generating an error. Most times this is just because the target is not a directory. Also close an fd leak introduced in the last commit.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/find/function.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index 80b8e6e9003..f69043ec695 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: function.c,v 1.15 1999/10/04 21:17:32 millert Exp $ */
+/* $OpenBSD: function.c,v 1.16 1999/10/04 21:26:10 millert Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -38,7 +38,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)function.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$OpenBSD: function.c,v 1.15 1999/10/04 21:17:32 millert Exp $";
+static char rcsid[] = "$OpenBSD: function.c,v 1.16 1999/10/04 21:26:10 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -453,7 +453,7 @@ f_execdir(plan, entry)
return (0);
}
if (chdir(entry->fts_accpath)) {
- warn("cannot chdir to %s", entry->fts_accpath);
+ (void) close(fd);
return (0);
}
}
@@ -484,8 +484,10 @@ f_execdir(plan, entry)
if (entry->fts_level == FTS_ROOTLEVEL) {
if (fchdir(fd) == -1) {
warn("unable to chdir back to starting directory");
+ (void) close(fd);
return (0);
}
+ (void) close(fd);
}
pid = waitpid(pid, &status, 0);