summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--Src/glob.c11
2 files changed, 9 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ab953e675..45066e8d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2014-06-05 Barton E. Schaefer <schaefer@zsh.org>
+ * 32723: Src/glob.c: add braces around some if/else branches
+
* 32716 (via Jun T. 31714): Src/utils.c: properly test iconv
return values for error conditions
diff --git a/Src/glob.c b/Src/glob.c
index c6cb3d2fc..15a5f70b7 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -462,18 +462,19 @@ scanner(Complist q, int shortcircuit)
int errssofar = errsfound;
struct dirsav ds;
- init_dirsav(&ds);
if (!q)
return;
+ init_dirsav(&ds);
if ((closure = q->closure)) {
/* (foo/)# - match zero or more dirs */
if (q->closure == 2) /* (foo/)## - match one or more dirs */
q->closure = 1;
- else
+ else {
scanner(q->next, shortcircuit);
if (shortcircuit && shortcircuit == matchct)
return;
+ }
}
p = q->pat;
/* Now the actual matching for the current path section. */
@@ -518,10 +519,11 @@ scanner(Complist q, int shortcircuit)
}
if (add) {
addpath(str, l);
- if (!closure || !statfullpath("", NULL, 1))
+ if (!closure || !statfullpath("", NULL, 1)) {
scanner((q->closure) ? q : q->next, shortcircuit);
if (shortcircuit && shortcircuit == matchct)
return;
+ }
pathbuf[pathpos = oppos] = '\0';
}
}
@@ -618,11 +620,12 @@ scanner(Complist q, int shortcircuit)
memcpy(subdirs + subdirlen, (char *)&errsfound,
sizeof(int));
subdirlen += sizeof(int);
- } else
+ } else {
/* if the last filename component, just add it */
insert(fn, 1);
if (shortcircuit && shortcircuit == matchct)
return;
+ }
}
}
closedir(lock);