X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=m4%2Fgetcwd-path-max.m4;h=4630a591f7570efa1ec3e705f8672a8c2d228ece;hb=d30babc23b4f25be970ada2e63a50220a3672281;hp=6b49f1abc91ebe062bb2e8c99a2fd69468b528ac;hpb=4aa85f09e755fc827cd5ab6225f20c83cd42245d;p=debian%2Ftar diff --git a/m4/getcwd-path-max.m4 b/m4/getcwd-path-max.m4 index 6b49f1ab..4630a591 100644 --- a/m4/getcwd-path-max.m4 +++ b/m4/getcwd-path-max.m4 @@ -6,7 +6,7 @@ # I've heard that this is due to a Linux kernel bug, and that it has # been fixed between 2.4.21-pre3 and 2.4.21-pre4. -# Copyright (C) 2003-2007, 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2003-2007, 2009-2015 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -122,6 +122,8 @@ main () if (PATH_MAX <= cwd_len && cwd_len < PATH_MAX + DIR_NAME_SIZE) { + struct stat sb; + c = getcwd (buf, PATH_MAX); if (!c && errno == ENOENT) { @@ -138,6 +140,16 @@ main () fail = 21; break; } + + /* Our replacement needs to be able to stat() long ../../paths, + so generate a path larger than PATH_MAX to check, + avoiding the replacement if we can't stat(). */ + c = getcwd (buf, cwd_len + 1); + if (c && !AT_FDCWD && stat (c, &sb) != 0 && is_ENAMETOOLONG (errno)) + { + fail = 32; + break; + } } if (dotdot_max <= cwd_len - initial_cwd_len) @@ -194,6 +206,7 @@ main () [case $? in 10|11|12) gl_cv_func_getcwd_path_max='no, but it is partly working';; 31) gl_cv_func_getcwd_path_max='no, it has the AIX bug';; + 32) gl_cv_func_getcwd_path_max='yes, but with shorter paths';; *) gl_cv_func_getcwd_path_max=no;; esac], [case "$host_os" in