Mercurial > hg > octave-nkf > gnulib-hg
changeset 15302:8f229ae087b4
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>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Mon, 20 Jun 2011 15:12:10 -0600 |
parents | deb35cf77594 |
children | 5fa23c9b72d6 |
files | ChangeLog modules/openat-tests modules/stat-tests tests/test-fstatat.c tests/test-stat.c tests/test-stat.h |
diffstat | 6 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-06-20 Eric Blake <eblake@redhat.com> + + test-stat: don't allocate PATH_MAX bytes + * 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. + 2011-06-20 Bruno Haible <bruno@clisp.org> float: Work around <float.h> bugs on FreeBSD/x86, AIX with GCC, IRIX.
--- a/modules/openat-tests +++ b/modules/openat-tests @@ -16,9 +16,9 @@ tests/macros.h Depends-on: +getcwd-lgpl ignore-value mgetgroups -pathmax progname usleep stat-time
--- a/modules/stat-tests +++ b/modules/stat-tests @@ -5,7 +5,7 @@ tests/macros.h Depends-on: -pathmax +getcwd-lgpl same-inode stdbool symlink
--- a/tests/test-fstatat.c +++ b/tests/test-fstatat.c @@ -31,7 +31,6 @@ #include <unistd.h> #include "openat.h" -#include "pathmax.h" #include "progname.h" #include "same-inode.h" #include "ignore-value.h"
--- a/tests/test-stat.c +++ b/tests/test-stat.c @@ -33,7 +33,6 @@ #include <stdio.h> #include <unistd.h> -#include "pathmax.h" #include "same-inode.h" #include "macros.h"
--- a/tests/test-stat.h +++ b/tests/test-stat.h @@ -27,9 +27,9 @@ { 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));