diff options
author | Pedro Alves <palves@redhat.com> | 2013-07-01 11:15:39 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2013-07-01 11:15:39 +0000 |
commit | 053794947ff80d6b4bcacbc282e4c054b84f5913 (patch) | |
tree | 8bcb13a0e5d679427fed498aecb8f2d77dd7e34b | |
parent | 62737b62efffd7b0df85898f25e1150a58641927 (diff) | |
download | gdb-053794947ff80d6b4bcacbc282e4c054b84f5913.tar.gz |
utils.c: pathconf call, check for _PC_PATH_MAX instead of HAVE_UNISTD_H.
This check in utils.c for HAVE_UNISTD_H is being used as proxy for
"HAVE_PATHCONF", as pathconf is supposed to be declared in unistd.h.
It's possible that there are systems out there that have realpath,
unistd.h and alloca, but not pathconf+_PC_PATH_MAX. I don't know of
any by heart, but if we import gnulib's unistd module (which a
following patch will do), then unistd.h ends up always available, so
the check ends up incorrect. As pathconf is being called with
_PC_PATH_MAX, check for that instead.
gdb/
2013-07-01 Pedro Alves <palves@redhat.com>
* utils.c <pathconf/_PC_PATH_MAX use>: Check if _PC_PATH_MAX is
defined instead of checking HAVE_UNISTD_H.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/utils.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a19367f6fc6..94c84647a6a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2013-07-01 Pedro Alves <palves@redhat.com> + * utils.c <pathconf/_PC_PATH_MAX use>: Check if _PC_PATH_MAX is + defined instead of checking HAVE_UNISTD_H. + +2013-07-01 Pedro Alves <palves@redhat.com> + Reimport gnulib from scratch. * gnulib/Makefile.in (aclocal_m4_deps): Remove reference to import/m4/onceonly.m4. diff --git a/gdb/utils.c b/gdb/utils.c index f5c133974fb..a2015a8401c 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -3179,7 +3179,7 @@ gdb_realpath (const char *filename) pathconf()) making it impossible to pass a correctly sized buffer to realpath() (it could always overflow). On those systems, we skip this. */ -#if defined (HAVE_REALPATH) && defined (HAVE_UNISTD_H) && defined(HAVE_ALLOCA) +#if defined (HAVE_REALPATH) && defined (_PC_PATH_MAX) && defined(HAVE_ALLOCA) { /* Find out the max path size. */ long path_max = pathconf ("/", _PC_PATH_MAX); |