diff options
author | Eric Blake <eblake@redhat.com> | 2011-06-20 15:12:10 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2011-06-20 15:38:42 -0600 |
commit | d80aff0ae74993962a24f205a356ffae59eab5be (patch) | |
tree | 1c3c49aa88bc01362779c479a8cfa193ecf1e6ed /tests | |
parent | 6187bd67c9ce5258a01fb1305b4257a67daa4154 (diff) | |
download | gnulib-d80aff0ae74993962a24f205a356ffae59eab5be.tar.gz |
test-stat: don't allocate PATH_MAX bytes
POSIX allows systems (like Hurd) that don't define PATH_MAX, or
which define it larger than a reasonable stack allocation should
be. The test originally used stack allocation to avoid portability
problems with getcwd, but the getcwd-lgpl module solves those.
* tests/test-stat.h (test_stat_func): Don't stack-allocate a
PATH_MAX-sized buffer.
* modules/openat-tests (Depends-on): Add getcwd-lgpl, drop pathmax.
* modules/stat-tests (Depends-on): Likewise.
* tests/test-fstatat.c (includes): Drop pathmax.h.
* tests/test-stat.c (includes): Likewise.
Reported by Bruno Haible.
Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-fstatat.c | 1 | ||||
-rw-r--r-- | tests/test-stat.c | 1 | ||||
-rw-r--r-- | tests/test-stat.h | 4 |
3 files changed, 2 insertions, 4 deletions
diff --git a/tests/test-fstatat.c b/tests/test-fstatat.c index dda0cd2241..aef1136552 100644 --- a/tests/test-fstatat.c +++ b/tests/test-fstatat.c @@ -31,7 +31,6 @@ SIGNATURE_CHECK (fstatat, int, (int, char const *, struct stat *, int)); #include <unistd.h> #include "openat.h" -#include "pathmax.h" #include "progname.h" #include "same-inode.h" #include "ignore-value.h" diff --git a/tests/test-stat.c b/tests/test-stat.c index 4cda08908b..cd74491f05 100644 --- a/tests/test-stat.c +++ b/tests/test-stat.c @@ -33,7 +33,6 @@ SIGNATURE_CHECK (stat, int, (char const *, struct stat *)); #include <stdio.h> #include <unistd.h> -#include "pathmax.h" #include "same-inode.h" #include "macros.h" diff --git a/tests/test-stat.h b/tests/test-stat.h index 22552dce03..3c8f7add0f 100644 --- a/tests/test-stat.h +++ b/tests/test-stat.h @@ -27,9 +27,9 @@ test_stat_func (int (*func) (char const *, struct stat *), bool print) { struct stat st1; struct stat st2; - char cwd[PATH_MAX]; + char *cwd = getcwd (NULL, 0); - ASSERT (getcwd (cwd, PATH_MAX) == cwd); + ASSERT (cwd); ASSERT (func (".", &st1) == 0); ASSERT (func ("./", &st2) == 0); ASSERT (SAME_INODE (st1, st2)); |