about summary refs log tree commit diff
path: root/Src/glob.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2014-06-09 09:50:37 +0100
committerPeter Stephenson <pws@zsh.org>2014-06-09 09:50:37 +0100
commit6336347c9e02ebae565b2d62987d1052bcba5567 (patch)
treec57790ed50fa12ab04733286bd10990d59fb13d0 /Src/glob.c
parent2ba4aa275e548ae9d4406e3bc8008bdfa1ce29eb (diff)
parent4f4d2b8247ef08e34fe73d91c0a8d8a2eb1f18c7 (diff)
downloadzsh-6336347c9e02ebae565b2d62987d1052bcba5567.tar.gz
zsh-6336347c9e02ebae565b2d62987d1052bcba5567.tar.xz
zsh-6336347c9e02ebae565b2d62987d1052bcba5567.zip
fix my own merge conflict with grammar changes
Diffstat (limited to 'Src/glob.c')
-rw-r--r--Src/glob.c11
1 files changed, 7 insertions, 4 deletions
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);