Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/find Use FD_CLOEXEC (for -exec).



details:   https://anonhg.NetBSD.org/src/rev/043c366d237d
branches:  trunk
changeset: 573071:043c366d237d
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Wed Jan 19 01:03:16 2005 +0000

description:
Use FD_CLOEXEC (for -exec).

diffstat:

 usr.bin/find/main.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 07a22413d42a -r 043c366d237d usr.bin/find/main.c
--- a/usr.bin/find/main.c       Wed Jan 19 00:59:48 2005 +0000
+++ b/usr.bin/find/main.c       Wed Jan 19 01:03:16 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.20 2003/08/07 11:13:42 agc Exp $    */
+/*     $NetBSD: main.c,v 1.21 2005/01/19 01:03:16 mycroft Exp $        */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -39,7 +39,7 @@
 #else
 __COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\n\
        The Regents of the University of California.  All rights reserved.\n");
-__RCSID("$NetBSD: main.c,v 1.20 2003/08/07 11:13:42 agc Exp $");
+__RCSID("$NetBSD: main.c,v 1.21 2005/01/19 01:03:16 mycroft Exp $");
 #endif
 #endif /* not lint */
 
@@ -151,7 +151,8 @@
                usage();
        *p = NULL;
 
-       if ((dotfd = open(".", O_RDONLY, 0)) < 0)
+       if ((dotfd = open(".", O_RDONLY, 0)) == -1 ||
+           fcntl(dotfd, F_SETFD, FD_CLOEXEC) == -1)
                err(1, ".");
 
        exit(find_execute(find_formplan(argv), start));



Home | Main Index | Thread Index | Old Index