diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2009-12-09 13:59:44 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2009-12-09 13:59:44 +0000 |
commit | f699d60fad50f050a8c1c226bd1e9da0b20f59fb (patch) | |
tree | bdf5b9815b92fd18dde6916127a53b24ac32e484 /usr.bin/find/main.c | |
parent | 4de50585e6004591ea1bd4250e88cea32a08ae70 (diff) |
We only need to fchdir(dotfd) for the -exec and -ok primaries so
defer the check for dotfd != -1 until we know we will need it.
Based on a diff from schwarze@
Diffstat (limited to 'usr.bin/find/main.c')
-rw-r--r-- | usr.bin/find/main.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/find/main.c b/usr.bin/find/main.c index 8c2190b98d1..48b2123c290 100644 --- a/usr.bin/find/main.c +++ b/usr.bin/find/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.24 2009/10/27 23:59:38 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.25 2009/12/09 13:59:43 millert Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -45,7 +45,7 @@ #include "find.h" time_t now; /* time find was run */ -int dotfd; /* starting directory */ +int dotfd; /* starting directory; may be -1 */ int ftsoptions; /* options for the fts_open(3) call */ int isdepth; /* do directories on post-order visit */ int isoutput; /* user specified output operator */ @@ -121,8 +121,7 @@ main(int argc, char *argv[]) err(1, NULL); paths = paths2; - if ((dotfd = open(".", O_RDONLY, 0)) < 0) - err(1, ".:"); + dotfd = open(".", O_RDONLY, 0); find_execute(find_formplan(argv), paths); exit(0); |