about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/compat.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index ba132c95d..ce0ddb4d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2019-11-19  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
+	* users/24451: Src/compat.c: zgetcwd: Add a guard against
+	returning an empty string.
+
 	* unposted: Test/W01history.ztst: Add smoke test for :P history
 	modifier.
 
diff --git a/Src/compat.c b/Src/compat.c
index 7131d91a4..02b66a780 100644
--- a/Src/compat.c
+++ b/Src/compat.c
@@ -519,7 +519,7 @@ zgetcwd(void)
 #endif /* HAVE_GETCWD */
     if (!ret)
 	ret = unmeta(pwd);
-    if (!ret)
+    if (!ret || *ret == '\0')
 	ret = dupstring(".");
     return ret;
 }