real_path: prevent redefinition of MAXSYMLINKS

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>
This commit is contained in:
Brandon Williams 2017-01-09 10:50:23 -08:00 committed by Junio C Hamano
parent e9a379c352
commit 7aeb81f1de

View File

@ -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