12489: pathconf for unlimited fs

This commit is contained in:
Clint Adams 2000-08-02 14:20:41 +00:00
parent 30e35ee2ed
commit de7b6730bc
3 changed files with 13 additions and 6 deletions

View file

@ -1,5 +1,8 @@
2000-08-02 Clint Adams <schizo@debian.org>
* 12489: Src/Modules/files.c, Src/Modules/parameter.c: check
errno change from pathconf() in case of unlimited path length.
* 12472: configure.in, Src/Modules/files.c,
Src/Modules/parameter.c: use pathconf() instead
of PATH_MAX if possible.

View file

@ -95,12 +95,13 @@ bin_mkdir(char *nam, char **args, char *ops, int func)
while(ptr > *args + (**args == '/') && *--ptr == '/')
*ptr = 0;
#ifdef HAVE_PATHCONF
if((pathmax = pathconf(*args,_PC_PATH_MAX)) == -1) {
errno = 0;
if(((pathmax = pathconf(*args,_PC_PATH_MAX)) == -1) && errno) {
zwarnnam(nam, "%s: %e", *args, errno);
err = 1;
continue;
}
else if(ztrlen(*args) > pathmax - 1) {
else if((ztrlen(*args) > pathmax - 1) && errno != -1) {
#else
if(ztrlen(*args) > PATH_MAX - 1) {
#endif

View file

@ -1400,11 +1400,13 @@ setpmnameddir(Param pm, char *value)
#ifdef HAVE_PATHCONF
int pathmax = 0;
errno = 0;
pathmax = pathconf(value, _PC_PATH_MAX);
if (pathmax == -1) {
if ((pathmax == -1) && errno) {
zwarn("%s: %e", value, errno);
}
else if (!value || *value != '/' || strlen(value) >= pathmax)
else if (!value || *value != '/' || ((strlen(value) >= pathmax) &&
pathmax != -1))
#else
if (!value || *value != '/' || strlen(value) >= PATH_MAX)
#endif
@ -1456,7 +1458,8 @@ setpmnameddirs(Param pm, HashTable ht)
v.pm = (Param) hn;
#ifdef HAVE_PATHCONF
if((pathmax = pathconf(val, _PC_PATH_MAX)) == -1)
errno = 0;
if((((pathmax = pathconf(val, _PC_PATH_MAX)) == -1)) && errno)
zwarn("%s: %e", val, errno);
else
#endif
@ -1464,7 +1467,7 @@ setpmnameddirs(Param pm, HashTable ht)
#ifdef HAVE_PATHCONF
strlen(val) >= PATH_MAX)
#else
strlen(val) >= pathmax)
((strlen(val) >= pathmax)) && pathmax != -1)
#endif
zwarn("invalid value: %s", val, 0);
else