Skip to content

Commit a8458ba

Browse files
pinotreemichalvasko
authored andcommitted
common BUGFIX define PATH_MAX if not available
PATH_MAX is optional in POSIX, and thus may not be provided (e.g. on GNU/Hurd). Provide a fallback definition for it, so the existing code keeps working for now; include <limits.h> to ensure that PATH_MAX is available if provided on the current OS/libc.
1 parent 05a8233 commit a8458ba

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ly_common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#ifndef LY_COMMON_H_
1717
#define LY_COMMON_H_
1818

19+
#include <limits.h>
1920
#include <pthread.h>
2021
#include <stddef.h>
2122
#include <stdint.h>
@@ -61,6 +62,11 @@ struct lysc_node;
6162
#define GETMACRO6(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
6263
#define GETMACRO7(_1, _2, _3, _4, _5, _6, _7, NAME, ...) NAME
6364

65+
/** optional in POSIX */
66+
#ifndef PATH_MAX
67+
# define PATH_MAX 4096
68+
#endif
69+
6470
/******************************************************************************
6571
* Logger
6672
*****************************************************************************/

0 commit comments

Comments
 (0)