diff options
author | Pádraig Brady <P@draigBrady.com> | 2014-12-16 02:35:19 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-12-16 09:07:27 +0000 |
commit | 4f3dc0beed3e47ce1945dd5f8ff993e9971223c0 (patch) | |
tree | f66b9d2884b3d65dd0ca236723fd72740465094f /tests | |
parent | 1fafbb302d231d0a28a8445c8f18fcb397021556 (diff) | |
download | gnulib-4f3dc0beed3e47ce1945dd5f8ff993e9971223c0.tar.gz |
getcwd: fix test failure on OS X 10.9
* m4/getcwd-path-max.m4: Avoid the replacement if it
won't be effective due to the PATH_MAX limitation of lstat().
(gl_cv_func_getcwd_path_max): Adjust to indicate this case.
* m4/getcwd.m4 (gl_FUNC_GETCWD): Define HAVE_GETCWD_SHORTER
for this case for use in tests, and also exclude this
case when setting REPLACE_GETCWD.
* tests/test-getcwd.c (test_long_name): Restrict the
tested path length so that lstat() will not be passed
a path greater than PATH_MAX.
Also key a test condition on HAVE_OPENAT_SUPPORT rather
than AT_FDCWD, since the latter is set unconditionally
since Sep 2009 in commit 52c658e9.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-getcwd.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/test-getcwd.c b/tests/test-getcwd.c index 2ddcd2067b..add40caf61 100644 --- a/tests/test-getcwd.c +++ b/tests/test-getcwd.c @@ -153,7 +153,13 @@ test_long_name (void) while (1) { +# ifdef HAVE_GETCWD_SHORTER + /* On OS/X <= 10.9 for example, we're restricted to shorter paths + as lstat() doesn't support more than PATH_MAX. */ + size_t dotdot_max = PATH_MAX * 2; +# else size_t dotdot_max = PATH_MAX * (DIR_NAME_SIZE / DOTDOTSLASH_LEN); +# endif char *c = NULL; cwd_len += DIR_NAME_SIZE; @@ -202,7 +208,7 @@ test_long_name (void) fail = 6; break; } - if (AT_FDCWD || errno == ERANGE || errno == ENOENT) + if (HAVE_OPENAT_SUPPORT || errno == ERANGE || errno == ENOENT) { fail = 7; break; |