From 759b73a4293e56209e922bf58d7028234e854338 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 3 Nov 2008 14:13:45 +0200 Subject: [PATCH] Ensure PATH_MAX is defined (ticket #3) Adam Tkac - 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 --- lib/query.c | 4 ---- misc/realpath.c | 12 ------------ system.h | 10 ++++++++++ 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/lib/query.c b/lib/query.c index 366355a..04b71bf 100644 --- a/lib/query.c +++ b/lib/query.c @@ -5,10 +5,6 @@ #include "system.h" -#ifndef PATH_MAX -# define PATH_MAX 255 -#endif - #include #include diff --git a/misc/realpath.c b/misc/realpath.c index fe50959..c0908d3 100644 --- a/misc/realpath.c +++ b/misc/realpath.c @@ -19,18 +19,6 @@ 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__ diff --git a/system.h b/system.h index 8c2f815..64c4003 100644 --- a/system.h +++ b/system.h @@ -181,6 +181,16 @@ char *realpath(const char *path, char resolved_path []); #include #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 #endif -- 2.7.4