From 377938212a3a4a5e78b466d57b1b7e2233ebe231 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 17 Apr 2002 17:17:17 +0000 Subject: Alexandre Duret-Lutz: 16930: Src/cond.c, Test/C02cond.ztst: Careful with long filenames in internal condition test; fix block file test for `-f'. --- Src/cond.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Src') 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; } -- cgit 1.4.1