summaryrefslogtreecommitdiff
path: root/lib/getcwd.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2011-08-17 17:51:47 -0600
committerEric Blake <eblake@redhat.com>2011-08-17 17:49:17 -0600
commit56d6664559f449af25f0d331457b014b02324d65 (patch)
tree97bb339092893f28d2368a7a86437ae08538b5c2 /lib/getcwd.c
parent1a6fbdd7d28dff1868c5eb0baf0029b27e42526a (diff)
downloadgnulib-56d6664559f449af25f0d331457b014b02324d65.tar.gz
getcwd: fix test failures on mingw
The GPL getcwd replacement now kicks in for mingw thanks to the signature check, but does not have to do anything. However, because the code was not taking an early exit for ERANGE when a buffer size was given, it instead tried to second-guess mingw's cwd algorithm, which doesn't work. After fixing that, the tests still failed, even though mingw getcwd doesn't have any problems with long paths (since they can't be created in the first place). * lib/getcwd.c (__getcwd): Early exit for ERANGE. * tests/test-getcwd.c (test_abort_bug, test_long_name): Don't fail test if long directory cannot be created, and allow mingw errno. Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'lib/getcwd.c')
-rw-r--r--lib/getcwd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/getcwd.c b/lib/getcwd.c
index f09fc3e8dd..cf155214a5 100644
--- a/lib/getcwd.c
+++ b/lib/getcwd.c
@@ -146,7 +146,7 @@ __getcwd (char *buf, size_t size)
# undef getcwd
dir = getcwd (buf, size);
- if (dir)
+ if (dir || (size && errno == ERANGE))
return dir;
/* Solaris getcwd (NULL, 0) fails with errno == EINVAL, but it has