summaryrefslogtreecommitdiff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2020-03-21 18:45:35 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2020-03-25 23:49:02 +0000
commit47fc5fe01fa315c38335739beb6102e103a80702 (patch)
tree9bf4ec46c2ff8e225bab2448bbe07849f49606de /Src/utils.c
parent12414d80523ed73a15c495b3a2f95c23ab61b2b8 (diff)
downloadzsh-47fc5fe01fa315c38335739beb6102e103a80702.tar.gz
zsh-47fc5fe01fa315c38335739beb6102e103a80702.zip
45583/0004: Fix segfault on resolving symlink loops
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Src/utils.c b/Src/utils.c
index 4d16de591..b0f6820fb 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1038,11 +1038,11 @@ xsymlink(char *s, int heap)
if (*s != '/')
return NULL;
*xbuf = '\0';
- if (xsymlinks(s + 1, 1) < 0)
+ if (!chrealpath(&s, 'P', heap)) {
zwarn("path expansion failed, using root directory");
- if (!*xbuf)
return heap ? dupstring("/") : ztrdup("/");
- return heap ? dupstring(xbuf) : ztrdup(xbuf);
+ }
+ return s;
}
/**/