diff options
Diffstat (limited to 'filesystem-posix.c')
-rw-r--r-- | filesystem-posix.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/filesystem-posix.c b/filesystem-posix.c index 1a23eff..ebf1407 100644 --- a/filesystem-posix.c +++ b/filesystem-posix.c @@ -69,3 +69,14 @@ int fs_mkdir(char const *path) { return -1; } } + +int fs_get_cwd(char *buf, size_t buflen) { + assert(buf && buflen); + if (getcwd(buf, buflen)) { + return 1; + } else if (errno == ERANGE) { + return 0; + } else { + return -1; + } +} |