diff --git a/src/files.c b/src/files.c index 0323d832..d2b6ff00 100644 --- a/src/files.c +++ b/src/files.c @@ -916,7 +916,9 @@ char *get_full_path(const char *origpath) d_here = getcwd(d_here, PATH_MAX + 1); while (d_here == NULL) { - chdir(".."); + if (chdir("..") == -1) + break; + d_here = getcwd(d_here, PATH_MAX + 1); }