Commit 5ee2fe77 by Ramsay Jones Committed by Shawn O. Pearce

Add a GIT_PATH_MAX constant

The PATH_MAX symbol is often, but not always, defined
in the <limits.h> header.  In particular, on cygwin you
need to include this header to avoid a compilation error.

However, some systems define PATH_MAX to be something as
small as 256, which POSIX is happy to allow, while others
allow much larger values.  In general it can vary from
one filesystem to another.

In order to avoid the vagaries of different systems, define
our own symbol.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
parent 192678b5
......@@ -10,4 +10,7 @@
#include <string.h>
#include "git/common.h"
#define GIT_PATH_MAX 4096
#endif /* INCLUDE_common_h__ */
#include "common.h"
#include "fileops.h"
int gitfo_read(git_file fd, void *buf, size_t cnt)
......@@ -141,7 +142,7 @@ int gitfo_close_cached(gitfo_cache *ioc)
*/
int git_foreach_dirent(const char *wd, int (*fn)(void *, const char *), void *arg)
{
char path[PATH_MAX];
char path[GIT_PATH_MAX];
size_t wd_len;
DIR *dir;
struct dirent *de;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment