From 22bd8011e89871bc6022d144f269dd05a4eb7bd4 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Sun, 7 Oct 2012 13:06:01 +0200 Subject: [PATCH] Fallback to PATH_MAX when pathconf is not available --- ChangeLog | 4 ++++ configure.ac | 2 +- src/ChangeLog | 6 ++++++ src/utils.c | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2f9498ad..104ca3cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-10-07 Giuseppe Scrivano + + * configure.ac: Check for patchconf. + 2012-09-23 Merinov Nikolay * m4/wget.m4 (WGET_FNMATCH): Add AC_LANG_SOURCE into diff --git a/configure.ac b/configure.ac index 873c3c92..a413b750 100644 --- a/configure.ac +++ b/configure.ac @@ -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) diff --git a/src/ChangeLog b/src/ChangeLog index 6fd091c2..13f75296 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-10-07 Tim Ruehsen + Giuseppe Scrivano + + * utils.c (get_max_length): If `pathconf' is not available + fallback to PATH_MAX. + 2012-10-06 Giuseppe Scrivano * http.c (http_loop): Send a HEAD request when -c and diff --git a/src/utils.c b/src/utils.c index 729ec50d..faae62e1 100644 --- a/src/utils.c +++ b/src/utils.c @@ -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. */