From 0bcd0b9c5ac5544eb6571addf9a7602b34b6c6ce Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Tue, 18 Sep 2012 19:58:32 +0200 Subject: If PATH_MAX is defined, use it --- src/gitto-path.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/gitto-path.c') diff --git a/src/gitto-path.c b/src/gitto-path.c index 7ed5f51..6d5be4d 100644 --- a/src/gitto-path.c +++ b/src/gitto-path.c @@ -19,15 +19,21 @@ #include #include +#include SCM_DEFINE(realpath_wrapper, "realpath", 1, 0, 0, (SCM path), "Transform PATH into an absolute path.") { char *relative_path = scm_to_locale_string(path); - char *resolved_path = realpath(relative_path, NULL); SCM scm_resolved_path = SCM_BOOL_F; +#ifdef PATH_MAX + char *resolved_path = calloc(sizeof(char), PATH_MAX + 1); +#else + char *resolved_path = NULL; +#endif + resolved_path = realpath(relative_path, resolved_path); if (resolved_path) scm_resolved_path = scm_from_locale_string(resolved_path); -- cgit v1.2.3-54-g00ecf