about summary refs log tree commit diff
path: root/Src/glob.c
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-02-20 08:17:38 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-02-20 08:17:38 +0000
commit945f54b00109f5abf4f64fef7388469364a3d70d (patch)
tree613d0e8a0d37884ee3bf4f0a2f24278dea18ac91 /Src/glob.c
parentcd220acea05cd06f7037caf715e8d67f9d36c7f4 (diff)
downloadzsh-945f54b00109f5abf4f64fef7388469364a3d70d.tar.gz
zsh-945f54b00109f5abf4f64fef7388469364a3d70d.tar.xz
zsh-945f54b00109f5abf4f64fef7388469364a3d70d.zip
18263: fix saving of glob state so that globs can be used from (e) glob qual
Diffstat (limited to 'Src/glob.c')
-rw-r--r--Src/glob.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Src/glob.c b/Src/glob.c
index ee23aa669..2e65fafc7 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -181,9 +181,9 @@ static struct globdata curglobdata;
     (N).gd_pathpos = pathpos; \
     (N).gd_pathbuf = pathbuf; \
     (N).gd_pathbufsz = 0; \
-    (N).gd_pathbuf = NULL; \
     (N).gd_glob_pre = glob_pre; \
     (N).gd_glob_suf = glob_suf; \
+    pathbuf = NULL; \
   } while (0)
 
 #define restore_globstate(N) \
@@ -234,7 +234,7 @@ addpath(char *s)
 }
 
 /* stat the filename s appended to pathbuf.  l should be true for lstat,    *
- * false for stat.  If st is NULL, the file is only chechked for existance. *
+ * false for stat.  If st is NULL, the file is only checked for existance.  *
  * s == "" is treated as s == ".".  This is necessary since on most systems *
  * foo/ can be used to reference a non-directory foo.  Returns nonzero if   *
  * the file does not exists.                                                */
@@ -1580,6 +1580,7 @@ zglob(LinkList list, LinkNode np, int nountok)
 	} else if (isset(NOMATCH)) {
 	    zerr("no matches found: %s", ostr, 0);
 	    free(matchbuf);
+	    restore_globstate(saved);
 	    return;
 	} else {
 	    /* treat as an ordinary string */