about summary refs log tree commit diff
path: root/Src/cond.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2002-04-17 17:17:42 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2002-04-17 17:17:42 +0000
commit91edfa3b258cfd90854eb50e1a2ad74fe95043ed (patch)
treebf592eed10b09408df59ce5c19c77930a93fff34 /Src/cond.c
parent6652004b53c1fff9f24b31a1bf67a0ad283829ea (diff)
downloadzsh-91edfa3b258cfd90854eb50e1a2ad74fe95043ed.tar.gz
zsh-91edfa3b258cfd90854eb50e1a2ad74fe95043ed.tar.xz
zsh-91edfa3b258cfd90854eb50e1a2ad74fe95043ed.zip
Alexandre Duret-Lutz: 16930: Src/cond.c, Test/C02cond.ztst:
Careful with long filenames in internal condition test; fix block
file test for `-f'.
Diffstat (limited to 'Src/cond.c')
-rw-r--r--Src/cond.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Src/cond.c b/Src/cond.c
index b34a14be1..4a4dc24ed 100644
--- a/Src/cond.c
+++ b/Src/cond.c
@@ -324,6 +324,8 @@ static struct stat st;
 static struct stat *
 getstat(char *s)
 {
+    char *us;
+
 /* /dev/fd/n refers to the open file descriptor n.  We always use fstat *
  * in this case since on Solaris /dev/fd/n is a device special file     */
     if (!strncmp(s, "/dev/fd/", 8)) {
@@ -332,7 +334,9 @@ getstat(char *s)
         return &st;
     }
 
-    if (stat(unmeta(s), &st))
+    if (!(us = unmeta(s)))
+        return NULL;
+    if (stat(us, &st))
 	return NULL;
     return &st;
 }