diff options
author | Tom Willemsen | 2012-09-18 19:58:32 +0200 |
---|---|---|
committer | Tom Willemsen | 2012-09-18 19:58:32 +0200 |
commit | 0bcd0b9c5ac5544eb6571addf9a7602b34b6c6ce (patch) | |
tree | fbb5458306365b82754c7df72a2e34e2681270af /src/gitto-path.c | |
parent | 395436103f3adea03e16827926127708c164d76c (diff) | |
download | gitto-0bcd0b9c5ac5544eb6571addf9a7602b34b6c6ce.tar.gz gitto-0bcd0b9c5ac5544eb6571addf9a7602b34b6c6ce.zip |
If PATH_MAX is defined, use it
Diffstat (limited to 'src/gitto-path.c')
-rw-r--r-- | src/gitto-path.c | 8 |
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); |