real_path: prevent redefinition of MAXSYMLINKS
authorBrandon Williams <bmwill@google.com>
Mon, 9 Jan 2017 18:50:23 +0000 (10:50 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 9 Jan 2017 19:25:57 +0000 (11:25 -0800)
The macro 'MAXSYMLINKS' is already defined on macOS and Linux in
<sys/param.h>. If 'MAXSYMLINKS' has already been defined, use the value
defined by the OS otherwise default to a value of 32 which is more
inline with what is allowed by many systems.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
abspath.c
index 1d56f5ed9f95002d018458c907625fff27472231..0393213e5af3a416c7b35397168b1b04611c2480 100644 (file)
--- a/abspath.c
+++ b/abspath.c
@@ -62,7 +62,9 @@ static void get_root_part(struct strbuf *resolved, struct strbuf *remaining)
 }
 
 /* We allow "recursive" symbolic links. Only within reason, though. */
-#define MAXSYMLINKS 5
+#ifndef MAXSYMLINKS
+#define MAXSYMLINKS 32
+#endif
 
 /*
  * Return the real path (i.e., absolute path, with symlinks resolved