diff options
| author | 2020-01-29 14:31:07 +0100 | |
|---|---|---|
| committer | 2020-01-29 19:01:07 +0530 | |
| commit | 46fc9c983c3c62e8c552e70ab9613380b868ae8f (patch) | |
| tree | 33fa792d19ec3faf9c8d42bccb0776137f1cc5ad | |
| parent | c434d8d4bcc5b875bf75ecb80b175c6088e5419c (diff) | |
| download | nnn-46fc9c983c3c62e8c552e70ab9613380b868ae8f.tar.gz | |
Fallbacks for absent NAME_MAX and PATH_MAX (#455)
* Fallbacks for absent NAME_MAX and PATH_MAX
Certainly NAME_MAX isn't guaranteed to exist and on (some versions of?)
Illumos and SmartOS it doesn't, so provide some reasonably accommodating
fallbacks.
* Smaller limits
* Remove now redundant PATH_MAX definition for Hurd
| -rw-r--r-- | src/nnn.c | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -74,9 +74,6 @@ #include <fcntl.h> #include <libgen.h> #include <limits.h> -#ifdef __gnu_hurd__ -#define PATH_MAX 4096 -#endif #ifndef NOLOCALE #include <locale.h> #endif @@ -118,6 +115,18 @@ #define S_BLKSIZE 512 /* S_BLKSIZE is missing on Android NDK (Termux) */ #endif +/* + * NAME_MAX and PATH_MAX may not exist, e.g. with dirent.c_name being a + * flexible array on Illumos. Use somewhat accomodating fallback values. + */ +#ifndef NAME_MAX +#define NAME_MAX 255 +#endif + +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + #define _ABSSUB(N, M) (((N) <= (M)) ? ((M) - (N)) : ((N) - (M))) #define DOUBLECLICK_INTERVAL_NS (400000000) #define XDELAY_INTERVAL_MS (350000) /* 350 ms delay */ |