Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/find Avoid testing a possibly uninitialized errno va...



details:   https://anonhg.NetBSD.org/src/rev/3c74057bf6aa
branches:  trunk
changeset: 778185:3c74057bf6aa
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sun Mar 18 17:09:46 2012 +0000

description:
Avoid testing a possibly uninitialized errno value when using -exit.
Closes PR 44973 (change is a somewhat more principled equivalent of
the patch suggested there) although I cannot replicate the reported
behavior unless I explicitly prepare errno with a nonzero value before
the fts_read loop.

diffstat:

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

diffs (27 lines):

diff -r 3dc5d61cbea7 -r 3c74057bf6aa usr.bin/find/find.c
--- a/usr.bin/find/find.c       Sun Mar 18 16:43:34 2012 +0000
+++ b/usr.bin/find/find.c       Sun Mar 18 17:09:46 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: find.c,v 1.27 2010/12/28 15:28:31 christos Exp $       */
+/*     $NetBSD: find.c,v 1.28 2012/03/18 17:09:46 dholland Exp $       */
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "from: @(#)find.c       8.5 (Berkeley) 8/5/94";
 #else
-__RCSID("$NetBSD: find.c,v 1.27 2010/12/28 15:28:31 christos Exp $");
+__RCSID("$NetBSD: find.c,v 1.28 2012/03/18 17:09:46 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -258,7 +258,7 @@
        }
 
        sig_unlock(&s);
-       if (errno)
+       if (g_entry == NULL && errno)
                err(1, "fts_read");
        (void)fts_close(tree);
 



Home | Main Index | Thread Index | Old Index