Ensure PATH_MAX is defined (ticket #3) Adam Tkac
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 3 Nov 2008 12:13:45 +0000 (14:13 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 3 Nov 2008 12:15:59 +0000 (14:15 +0200)
- POSIX doesn't require PATH_MAX to be defined as constant, and Hurd
  doesn't define it...
- deal with it just once in system.h for now, the proper fix is to get
  rid of needing it at all (ie add a mallocing realpath() clone to librpmio)
- patch from Adam Tkac
(cherry picked from commit 759b73a4293e56209e922bf58d7028234e854338)

lib/query.c
misc/realpath.c
system.h

index 519fbdd..be374b4 100644 (file)
@@ -5,10 +5,6 @@
 
 #include "system.h"
 
-#ifndef PATH_MAX
-# define PATH_MAX 255
-#endif
-
 #include <inttypes.h>
 
 #include <rpm/rpmcli.h>
index fe50959..c0908d3 100644 (file)
 extern int errno;
 #endif
 
-#ifndef PATH_MAX
-#ifdef _POSIX_VERSION
-#define PATH_MAX _POSIX_PATH_MAX
-#else
-#ifdef MAXPATHLEN
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
-#endif
-#endif
-
 #define MAX_READLINKS 32
 
 #ifdef __STDC__
index 7bac087..8022fbc 100644 (file)
--- a/system.h
+++ b/system.h
@@ -185,6 +185,16 @@ char *realpath(const char *path, char resolved_path []);
 #include <limits.h>
 #endif
 
+#ifndef PATH_MAX
+#ifdef _POSIX_PATH_MAX
+#define PATH_MAX _POSIX_PATH_MAX
+#elif defined MAXPATHLEN
+#define PATH_MAX MAXPATHLEN
+#else
+#define PATH_MAX 256
+#endif
+#endif
+
 #if HAVE_ERR_H
 #include <err.h>
 #endif