Satisfy compiler warning about unchecked getcwd() return

TODO: raise an error
This commit is contained in:
Lassi Kortela 2019-08-28 00:27:28 +03:00
parent 3ad4f9f199
commit ca3ab55a5c
1 changed files with 6 additions and 1 deletions

View File

@ -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)
{