aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gitto-path.c8
1 files changed, 7 insertions, 1 deletions
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 <stdlib.h>
#include <libguile.h>
+#include <limits.h>
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);