1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-30 15:02:18 +01:00

Alexandre Duret-Lutz: 16930: Src/cond.c, Test/C02cond.ztst:

Careful with long filenames in internal condition test; fix block
file test for `-f'.
This commit is contained in:
Peter Stephenson 2002-04-17 17:17:42 +00:00
parent 6652004b53
commit 91edfa3b25
3 changed files with 17 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2002-04-17 Peter Stephenson <pws@csr.com>
* Alexandre Duret-Lutz: 16930: Src/cond.c, Test/C02cond.ztst:
Careful with long filenames in internal condition test; fix block
file test for `-f'.
2002-04-17 Sven Wischnowsky <wischnow@zsh.org>
* 16998: Src/Zle/computil.c: make compvalues unquote the string

View file

@ -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;
}

View file

@ -52,7 +52,12 @@
[[ -e zerolength && ! -e nonexistent ]]
0:-e cond
[[ -f zerolength && ! -f cond && ! -f $char && ! -f $block && ! -f . ]]
if [[ -n $block ]]; then
[[ -f zerolength && ! -f cond && ! -f $char && ! -f $block[(f)1] && ! -f . ]]
else
print -u8 'Warning: Not testing [[ -f blockdevice ]] (no devices found)'
[[ -f zerolength && ! -f cond && ! -f $char && ! -f . ]]
fi
0:-f cond
[[ -g modish && ! -g zerolength ]]