summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-03-12 16:41:12 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2023-05-05 21:21:39 -0500
commitf3d1279bfa2626811cd4a8c6f603dde46d29aba5 (patch)
tree57d1ba6535901cadd10a7b7091e559b9eeacd893 /src
parentbc4d9cb354363141247f7bc6ab8b0fee563dae97 (diff)
downloadmusl-f3d1279bfa2626811cd4a8c6f603dde46d29aba5.tar.gz
musl-f3d1279bfa2626811cd4a8c6f603dde46d29aba5.tar.bz2
musl-f3d1279bfa2626811cd4a8c6f603dde46d29aba5.tar.xz
musl-f3d1279bfa2626811cd4a8c6f603dde46d29aba5.zip
getcwd: fail with ENOMEM on ENAMETOOLONG
Diffstat (limited to 'src')
-rw-r--r--src/unistd/getcwd.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/unistd/getcwd.c b/src/unistd/getcwd.c
index f407ffe0..4fd3a60c 100644
--- a/src/unistd/getcwd.c
+++ b/src/unistd/getcwd.c
@@ -15,8 +15,11 @@ char *getcwd(char *buf, size_t size)
return 0;
}
long ret = syscall(SYS_getcwd, buf, size);
- if (ret < 0)
+ if (ret < 0) {
+ if (errno == ENAMETOOLONG)
+ errno = ENOMEM;
return 0;
+ }
if (ret == 0 || buf[0] != '/') {
errno = ENOENT;
return 0;