Module Name: src Committed By: lukem Date: Fri Jul 21 22:05:04 UTC 2023
Modified Files: src/tools/compat: compat_defs.h Log Message: tools/compat/compat_defs.h: improve NAME_MAX compat Move the NAME_MAX workaround to the <limits.h> section, and don't assume that _XOPEN_NAME_MAX is available. To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/tools/compat/compat_defs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tools/compat/compat_defs.h diff -u src/tools/compat/compat_defs.h:1.121 src/tools/compat/compat_defs.h:1.122 --- src/tools/compat/compat_defs.h:1.121 Sat Jul 8 19:10:00 2023 +++ src/tools/compat/compat_defs.h Fri Jul 21 22:05:04 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_defs.h,v 1.121 2023/07/08 19:10:00 palle Exp $ */ +/* $NetBSD: compat_defs.h,v 1.122 2023/07/21 22:05:04 lukem Exp $ */ #ifndef __NETBSD_COMPAT_DEFS_H__ #define __NETBSD_COMPAT_DEFS_H__ @@ -31,17 +31,6 @@ #endif /* __linux__ && HAVE_FEATURES_H */ /* - * Solaris: - * No NAME_MAX define is available (as documented in the Solaris - * limits.h file), so use the XOPEN defined constant. - */ - -#if defined(__sun__) -#define NAME_MAX _XOPEN_NAME_MAX -#endif - - -/* * Type substitutes. * These are controlled via HAVE_TYPE protections and some of them are needed * in other header files (in the build tree not in the host). This is because @@ -1007,6 +996,15 @@ void *setmode(const char *); #ifndef MAXPATHLEN #define MAXPATHLEN 4096 #endif + +#ifndef NAME_MAX +#ifdef _XOPEN_NAME_MAX +#define NAME_MAX _XOPEN_NAME_MAX +#else +#error "Both NAME_MAX and _XOPEN_NAME_MAX are not defined" +#endif +#endif + #ifndef PATH_MAX #define PATH_MAX MAXPATHLEN #endif