Skip to content

Commit d0c2449

Browse files
author
Junio C Hamano
committed
Define fallback PATH_MAX on systems that do not define one in <limits.h>
Notably on GNU/Hurd, as reported by Gerrit Pape. Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 17fd965 commit d0c2449

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

builtin.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#ifndef BUILTIN_H
22
#define BUILTIN_H
33

4-
#include <stdio.h>
5-
#include <limits.h>
4+
#include "git-compat-util.h"
65

76
extern const char git_version_string[];
87
extern const char git_usage_string[];

git-compat-util.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
#include <sys/types.h>
2727
#include <dirent.h>
2828

29+
/* On most systems <limits.h> would have given us this, but
30+
* not on some systems (e.g. GNU/Hurd).
31+
*/
32+
#ifndef PATH_MAX
33+
#define PATH_MAX 4096
34+
#endif
35+
2936
#ifdef __GNUC__
3037
#define NORETURN __attribute__((__noreturn__))
3138
#else

0 commit comments

Comments
 (0)