summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2017-02-15 15:58:40 +0000
committerschwarze <schwarze@openbsd.org>2017-02-15 15:58:40 +0000
commit7120799d7f7c8de5acd19348fa172f343a06c536 (patch)
tree99cf0caa94a24b40bd11dc8e5bde6d4bf4c1eb58 /lib/libc
parentBump MAXTSIZ to 64M on arm. (diff)
downloadwireguard-openbsd-7120799d7f7c8de5acd19348fa172f343a06c536.tar.xz
wireguard-openbsd-7120799d7f7c8de5acd19348fa172f343a06c536.zip
Style improvement, no functional change.
As reported by Yuri Pankov, some versions of GCC whine that "tmp" might be used uninitialized in fts_open(3). Clearly, that cannot actually happen, but explicitly setting it to NULL is safer anyway. While here, rename the badly named variable "tmp" and make the inner "if" easier to understand. Feedback and OK guenther@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/fts.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index bcf9d1661f1..ad4fb0423f9 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fts.c,v 1.56 2016/09/21 04:38:56 guenther Exp $ */
+/* $OpenBSD: fts.c,v 1.57 2017/02/15 15:58:40 schwarze Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -74,7 +74,7 @@ fts_open(char * const *argv, int options,
FTS *sp;
FTSENT *p, *root;
int nitems;
- FTSENT *parent, *tmp;
+ FTSENT *parent, *prev;
/* Options check. */
if (options & ~FTS_OPTIONMASK) {
@@ -111,7 +111,7 @@ fts_open(char * const *argv, int options,
parent->fts_level = FTS_ROOTPARENTLEVEL;
/* Allocate/initialize root(s). */
- for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) {
+ for (root = prev = NULL, nitems = 0; *argv; ++argv, ++nitems) {
if ((p = fts_alloc(sp, *argv, strlen(*argv))) == NULL)
goto mem3;
p->fts_level = FTS_ROOTLEVEL;
@@ -133,11 +133,10 @@ fts_open(char * const *argv, int options,
} else {
p->fts_link = NULL;
if (root == NULL)
- tmp = root = p;
- else {
- tmp->fts_link = p;
- tmp = p;
- }
+ root = p;
+ else
+ prev->fts_link = p;
+ prev = p;
}
}
if (compar && nitems > 1)