1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-13 11:21:13 +02:00

12548: Tweak 12547.

This commit is contained in:
Bart Schaefer 2000-08-05 06:52:14 +00:00
parent 1ff8518b16
commit 1859bb2d0a
2 changed files with 13 additions and 14 deletions

View file

@ -1,6 +1,6 @@
2000-08-04 Bart Schaefer <schaefer@zsh.org>
* 12547: configure.in, Src/compat.c, Src/Modules/files.c:
* 12547, 12458: configure.in, Src/compat.c, Src/Modules/files.c:
Handle ENOENT and ENOTDIR within zpathmax(), and therefore back
out the changes from 12541 and 12533.

View file

@ -133,8 +133,6 @@ zpathmax(char *dir)
{
long pathmax;
if (!dir || !*dir)
dir = ".";
errno = 0;
if ((pathmax = pathconf(dir, _PC_PATH_MAX)) >= 0) {
/* This code is redundant if pathconf works correctly, but *
@ -152,18 +150,19 @@ zpathmax(char *dir)
*tail = 0;
pathmax = zpathmax(dir);
*tail = '/';
if (pathmax > 0) {
if (strlen(dir) < pathmax)
return pathmax;
else
errno = ENAMETOOLONG;
}
} else {
errno = 0;
if (tail)
pathmax = pathconf("/", _PC_PATH_MAX);
else
pathmax = pathconf(".", _PC_PATH_MAX);
}
if (pathmax > 0) {
if (strlen(dir) < pathmax)
return pathmax;
else
errno = ENAMETOOLONG;
}
/* else *
* Either we're at the root (tail == dir) or we're on the first *
* component of a relative path (tail == NULL). Either way we *
* have nothing to do here, the error from pathconf() is real. *
* Perhaps our current working directory has been removed? */
}
if (errno)
return -1;