summaryrefslogtreecommitdiff
path: root/Src/cond.c
diff options
context:
space:
mode:
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;
}