Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/find PR/57313: Timo Buhrmester: Don't bail if "." ca...
details: https://anonhg.NetBSD.org/src/rev/b340114282fe
branches: trunk
changeset: 374127:b340114282fe
user: christos <christos%NetBSD.org@localhost>
date: Sat Apr 01 15:57:20 2023 +0000
description:
PR/57313: Timo Buhrmester: Don't bail if "." cannot be opened. From FreeBSD
diffstat:
usr.bin/find/function.c | 10 ++++++----
usr.bin/find/main.c | 8 ++++----
2 files changed, 10 insertions(+), 8 deletions(-)
diffs (68 lines):
diff -r 27e28b7a84f2 -r b340114282fe usr.bin/find/function.c
--- a/usr.bin/find/function.c Sat Apr 01 12:41:02 2023 +0000
+++ b/usr.bin/find/function.c Sat Apr 01 15:57:20 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: function.c,v 1.79 2021/03/18 18:24:14 cheusov Exp $ */
+/* $NetBSD: function.c,v 1.80 2023/04/01 15:57:20 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "from: @(#)function.c 8.10 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: function.c,v 1.79 2021/03/18 18:24:14 cheusov Exp $");
+__RCSID("$NetBSD: function.c,v 1.80 2023/04/01 15:57:20 christos Exp $");
#endif
#endif /* not lint */
@@ -641,7 +641,8 @@ f_exec(PLAN *plan, FTSENT *entry)
err(1, "vfork");
/* NOTREACHED */
case 0:
- if (fchdir(dotfd)) {
+ /* change dir back from where we started */
+ if (!(ftsoptions & FTS_NOCHDIR) && fchdir(dotfd)) {
warn("chdir");
_exit(1);
}
@@ -673,7 +674,8 @@ run_f_exec(PLAN *plan)
err(1, "vfork");
/* NOTREACHED */
case 0:
- if (fchdir(dotfd)) {
+ /* change dir back from where we started */
+ if (!(ftsoptions & FTS_NOCHDIR) && fchdir(dotfd)) {
warn("chdir");
_exit(1);
}
diff -r 27e28b7a84f2 -r b340114282fe usr.bin/find/main.c
--- a/usr.bin/find/main.c Sat Apr 01 12:41:02 2023 +0000
+++ b/usr.bin/find/main.c Sat Apr 01 15:57:20 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.31 2013/01/24 17:50:08 christos Exp $ */
+/* $NetBSD: main.c,v 1.32 2023/04/01 15:57:20 christos Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -39,7 +39,7 @@ static char sccsid[] = "@(#)main.c 8.4 (
#else
__COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\
The Regents of the University of California. All rights reserved.");
-__RCSID("$NetBSD: main.c,v 1.31 2013/01/24 17:50:08 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.32 2023/04/01 15:57:20 christos Exp $");
#endif
#endif /* not lint */
@@ -149,9 +149,9 @@ main(int argc, char *argv[])
*p = NULL;
if ((dotfd = open(".", O_RDONLY | O_CLOEXEC, 0)) == -1)
- err(1, ".");
+ ftsoptions |= FTS_NOCHDIR;
- exit(find_execute(find_formplan(argv), start));
+ return find_execute(find_formplan(argv), start);
}
static void
Home |
Main Index |
Thread Index |
Old Index