summaryrefslogtreecommitdiff
path: root/nuttx/lib/unistd
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/lib/unistd')
-rw-r--r--nuttx/lib/unistd/lib_chdir.c2
-rw-r--r--nuttx/lib/unistd/lib_getcwd.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/nuttx/lib/unistd/lib_chdir.c b/nuttx/lib/unistd/lib_chdir.c
index 15dc64383..c054f2b23 100644
--- a/nuttx/lib/unistd/lib_chdir.c
+++ b/nuttx/lib/unistd/lib_chdir.c
@@ -173,7 +173,7 @@ int chdir(FAR const char *path)
return OK;
errout:
- errno = err;
+ set_errno(err);
return ERROR;
}
#endif /* CONFIG_NFILE_DESCRIPTORS && !CONFIG_DISABLE_ENVIRON */
diff --git a/nuttx/lib/unistd/lib_getcwd.c b/nuttx/lib/unistd/lib_getcwd.c
index 6888470ac..9bfa102fb 100644
--- a/nuttx/lib/unistd/lib_getcwd.c
+++ b/nuttx/lib/unistd/lib_getcwd.c
@@ -99,11 +99,13 @@ FAR char *getcwd(FAR char *buf, size_t size)
/* Verify input parameters */
+#ifdef CONFIG_DEBUG
if (!buf || !size)
{
- errno = EINVAL;
+ set_errno(EINVAL);
return NULL;
}
+#endif
/* If no working directory is defined, then default to the home directory */
@@ -117,7 +119,7 @@ FAR char *getcwd(FAR char *buf, size_t size)
if (strlen(pwd) + 1 > size)
{
- errno = ERANGE;
+ set_errno(ERANGE);
return NULL;
}