summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2014-11-13 19:44:01 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2014-11-13 19:44:01 +0000
commitc01a178ece6740f719fef81ecdf9283b5c8b71d5 (patch)
tree4d3ef52cb971fda2be9024a5b828a5a1ca4edc34
parentc1d9623d2e564024452096c897f380fa2fcdb831 (diff)
downloadzsh-c01a178ece6740f719fef81ecdf9283b5c8b71d5.tar.gz
zsh-c01a178ece6740f719fef81ecdf9283b5c8b71d5.zip
Marc Finet: problems with working directory rationalisation.
Ensure the length of the directory is kept up to date. Abort following symlinks as soon as there's an error.
-rw-r--r--ChangeLog6
-rw-r--r--Src/utils.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 86c8afb92..b1275efe4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-13 Peter Stephenson <p.w.stephenson@ntlworld.com>
+
+ * Marc Finet: 33687 (first and last patches): ensure length of
+ working directory is correct and return as soon as there's
+ an error chasing symlinks.
+
2014-11-13 Barton E. Schaefer <schaefer@zsh.org>
* 33686: Test/B06fc.ztst: set PS1 before pattern-matching for it
diff --git a/Src/utils.c b/Src/utils.c
index e6eb8e6a7..c6e7aed35 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -727,7 +727,7 @@ xsymlinks(char *s)
zulong xbuflen = strlen(xbuf);
opp = pp = slashsplit(s);
- for (; xbuflen < sizeof(xbuf) && *pp; pp++) {
+ for (; xbuflen < sizeof(xbuf) && *pp && ret >= 0; pp++) {
if (!strcmp(*pp, "."))
continue;
if (!strcmp(*pp, "..")) {
@@ -762,9 +762,13 @@ xsymlinks(char *s)
strcpy(xbuf, "");
if (xsymlinks(xbuf3 + 1) < 0)
ret = -1;
+ else
+ xbuflen = strlen(xbuf);
} else
if (xsymlinks(xbuf3) < 0)
ret = -1;
+ else
+ xbuflen = strlen(xbuf);
}
}
freearray(opp);