diff --git a/c/os_unix.c b/c/os_unix.c index 80d836c..e7bfe8c 100644 --- a/c/os_unix.c +++ b/c/os_unix.c @@ -28,7 +28,12 @@ void path_to_dirname(char *path) *p = '\0'; } -void get_cwd(char *buf, size_t size) { getcwd(buf, size); } +void get_cwd(char *buf, size_t size) +{ + if (!getcwd(buf, size)) { + memset(buf, 0, size); + } +} int set_cwd(char *buf) {