From 1397bf133b829174a06f6d13f32bec68eb8545ed Mon Sep 17 00:00:00 2001 From: Roger Shimizu Date: Tue, 10 Jan 2017 07:46:18 +0900 Subject: [PATCH] Fix FTBFS of PATH_MAX on GNU/Hurd Info: - https://www.gnu.org/software/hurd/community/gsoc/project_ideas/maxpath.html - https://www.gnu.org/software/hurd/hurd/porting/guidelines.html#PATH_MAX_tt_MAX_PATH_tt_MAXPATHL Quote: when the __GLIBC__ macro is defined, getcwd() calls can be just replaced by get_current_dir_name() calls. --- src/plugin.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugin.c b/src/plugin.c index 85dc2b46..ff683acc 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -101,11 +101,12 @@ start_plugin(const char *plugin, env = cork_env_clone_current(); const char *path = cork_env_get(env, "PATH"); if (path != NULL) { - char cwd[PATH_MAX]; - if (!getcwd(cwd, PATH_MAX)) { + char *cwd = get_current_dir_name(); + if (cwd) { size_t path_len = strlen(path) + strlen(cwd) + 2; new_path = ss_malloc(path_len); snprintf(new_path, path_len, "%s:%s", cwd, path); + free(cwd); } }