Fallback to PATH_MAX when pathconf is not available

This commit is contained in:
Giuseppe Scrivano 2012-10-07 13:06:01 +02:00
parent fe401688a6
commit 22bd8011e8
4 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2012-10-07 Giuseppe Scrivano <gscrivano@gnu.org>
* configure.ac: Check for patchconf.
2012-09-23 Merinov Nikolay <kim.roader@gmail.com>
* m4/wget.m4 (WGET_FNMATCH): Add AC_LANG_SOURCE into

View File

@ -198,7 +198,7 @@ dnl Checks for library functions.
dnl
AC_FUNC_MMAP
AC_FUNC_FSEEKO
AC_CHECK_FUNCS(strptime timegm vsnprintf vasprintf drand48)
AC_CHECK_FUNCS(strptime timegm vsnprintf vasprintf drand48 pathconf)
AC_CHECK_FUNCS(strtoll usleep ftello sigblock sigsetjmp memrchr wcwidth mbtowc)
AC_CHECK_FUNCS(sleep symlink utime)

View File

@ -1,3 +1,9 @@
2012-10-07 Tim Ruehsen <tim.ruehsen@gmx.de>
Giuseppe Scrivano <gscrivano@gnu.org>
* utils.c (get_max_length): If `pathconf' is not available
fallback to PATH_MAX.
2012-10-06 Giuseppe Scrivano <gscrivano@gnu.org>
* http.c (http_loop): Send a HEAD request when -c and

View File

@ -2509,9 +2509,13 @@ get_max_length (const char *path, int length, int name)
{
errno = 0;
/* For an empty path query the current directory. */
#if HAVE_PATHCONF
ret = pathconf (*p ? p : ".", name);
if (!(ret < 0 && errno == ENOENT))
break;
#else
ret = PATH_MAX;
#endif
/* The path does not exist yet, but may be created. */
/* Already at current or root directory, give up. */