diff options
author | Jim Meyering <jim@meyering.net> | 2003-03-05 08:35:36 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-03-05 08:35:36 +0000 |
commit | 66d86350c4d8342e77af86fe2e99b63e27815b54 (patch) | |
tree | b8d4283b68039533a5d01e1fa598320393e2b9c3 /m4 | |
parent | 51a43a8c56e16633907158c6261168efef511909 (diff) | |
download | coreutils-66d86350c4d8342e77af86fe2e99b63e27815b54.tar.xz |
name changes
add comments
fix logic
Diffstat (limited to 'm4')
-rw-r--r-- | m4/getcwd-robust.m4 | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/m4/getcwd-robust.m4 b/m4/getcwd-robust.m4 index 9531bae4d..e91fa64f5 100644 --- a/m4/getcwd-robust.m4 +++ b/m4/getcwd-robust.m4 @@ -1,12 +1,18 @@ #serial 1 -# Check whether getcwd can return a path longer than PATH_MAX. -# If not, arrange to compile the wrapper function. +# Check whether getcwd has the bug that it succeeds for a working directory +# longer than PATH_MAX, yet returns a truncated directory name. +# If so, arrange to compile the wrapper function. + +# This is necessary for at least GNU libc on linux-2.4.19 and 2.4.20. +# 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. */ + # From Jim Meyering -AC_DEFUN([GL_FUNC_GETCWD_ROBUST], +AC_DEFUN([GL_FUNC_GETCWD_PATH_MAX], [ - AC_CACHE_CHECK([whether getcwd can return a path longer than PATH_MAX], - utils_cv_func_getcwd_robust, + AC_CACHE_CHECK([whether getcwd properly handles paths longer than PATH_MAX], + utils_cv_func_getcwd_vs_path_max, [ # Arrange for deletion of the temporary directory this test creates. ac_clean_files="$ac_clean_files confdir3" @@ -71,10 +77,12 @@ main () size_t len; cwd_len += 1 + strlen (DIR_NAME); + /* If mkdir or chdir fails, be pessimistic and consider that + as a failure, too. */ if (mkdir (DIR_NAME, 0700) < 0 || chdir (DIR_NAME) < 0 - || (c = getcwd (buf, PATH_MAX)) == NULL - || (len = strlen (c)) != cwd_len) + || ((c = getcwd (buf, PATH_MAX)) != NULL + && (len = strlen (c)) != cwd_len)) { fail = 1; break; @@ -104,11 +112,11 @@ main () #endif } ]])], - [utils_cv_func_getcwd_robust=yes], - [utils_cv_func_getcwd_robust=no], - [utils_cv_func_getcwd_robust=no])]) + [utils_cv_func_getcwd_vs_path_max=yes], + [utils_cv_func_getcwd_vs_path_max=no], + [utils_cv_func_getcwd_vs_path_max=no])]) - if test $utils_cv_func_getcwd_robust = yes; then + if test $utils_cv_func_getcwd_vs_path_max = yes; then AC_LIBOBJ(getcwd) AC_DEFINE(getcwd, rpl_getcwd, [Define to rpl_getcwd if the wrapper function should be used.]) |