utils.c: pathconf call, check for _PC_PATH_MAX instead of HAVE_UNISTD_H.
authorPedro Alves <palves@redhat.com>
Mon, 1 Jul 2013 11:15:39 +0000 (11:15 +0000)
committerPedro Alves <palves@redhat.com>
Mon, 1 Jul 2013 11:15:39 +0000 (11:15 +0000)
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.

gdb/ChangeLog
gdb/utils.c

index a19367f6fc62edd91d63d490cfb251e2898cea90..94c84647a6a0ad722196577a294ac189d69958d9 100644 (file)
@@ -1,3 +1,8 @@
+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.
index f5c133974fbb588515dc01d6fb43b84d2636db65..a2015a8401c3d099ffd993ac6ea7d142b63201b0 100644 (file)
@@ -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);
This page took 0.029571 seconds and 4 git commands to generate.