[PATCH:xauth] include limits.h for PATH_MAX on OS'es without sys/syslimits.h

Mark Kettenis mark.kettenis at xs4all.nl
Fri Jan 2 11:40:49 PST 2015


> From: Alan Coopersmith <alan.coopersmith at oracle.com>
> Date: Fri,  2 Jan 2015 09:50:36 -0800

Are there any systems that have <sys/syslimits.h> but don't have a
<limits.h> that provides PATH_MAX?  POSIX requires that <limits.h>
provides PATH_MAX.  And as far as I can tell <sys/syslimits.h> is a
BSD-ism, and has always been included by <limits.h>.

So I think you can just replace <sys/syslimits.h> with <limits.h> and
drop the additional autoconf check.

> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  configure.ac |    2 +-
>  gethost.c    |    4 ++++
>  parsedpy.c   |    4 ++++
>  3 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 2d36ed5..5a3f190 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -41,7 +41,7 @@ m4_ifndef([XORG_MACROS_VERSION],
>  XORG_MACROS_VERSION(1.8)
>  XORG_DEFAULT_OPTIONS
>  
> -AC_CHECK_HEADERS([net/errno.h])
> +AC_CHECK_HEADERS([net/errno.h sys/syslimits.h])
>  
>  AC_CHECK_FUNCS([strlcpy])
>  
> diff --git a/gethost.c b/gethost.c
> index c75ae02..e8e332a 100644
> --- a/gethost.c
> +++ b/gethost.c
> @@ -58,7 +58,11 @@ in this Software without prior written authorization from The Open Group.
>  #include "xauth.h"
>  
>  #include <sys/stat.h>
> +#ifdef HAVE_SYS_SYSLIMITS_H
>  #include <sys/syslimits.h>
> +#else
> +#include <limits.h>
> +#endif
>  
>  #ifndef WIN32
>  #include <arpa/inet.h>
> diff --git a/parsedpy.c b/parsedpy.c
> index 7365224..f43d78d 100644
> --- a/parsedpy.c
> +++ b/parsedpy.c
> @@ -43,7 +43,11 @@ in this Software without prior written authorization from The Open Group.
>  #include <X11/Xmu/SysUtil.h>
>  
>  #include <sys/stat.h>
> +#ifdef HAVE_SYS_SYSLIMITS_H
>  #include <sys/syslimits.h>
> +#else
> +#include <limits.h>
> +#endif
>  
>  #if defined(UNIXCONN) || defined(LOCALCONN)
>  #define UNIX_CONNECTION "unix"
> -- 
> 1.7.9.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 
> 


More information about the xorg-devel mailing list