This commit is contained in:
Max Lv
2017-01-10 21:57:38 +08:00
parent 1397bf133b
commit ecf1fcc845
2 changed files with 6 additions and 3 deletions
+5
View File
@@ -101,8 +101,13 @@ start_plugin(const char *plugin,
env = cork_env_clone_current();
const char *path = cork_env_get(env, "PATH");
if (path != NULL) {
#ifdef __GLIBC__
char *cwd = get_current_dir_name();
if (cwd) {
#else
char cwd[PATH_MAX];
if (!getcwd(cwd, PATH_MAX)) {
#endif
size_t path_len = strlen(path) + strlen(cwd) + 2;
new_path = ss_malloc(path_len);
snprintf(new_path, path_len, "%s:%s", cwd, path);