summaryrefslogtreecommitdiff
path: root/doc/posix-functions/getcwd.texi
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2011-05-13 10:26:08 -0600
committerEric Blake <eblake@redhat.com>2011-05-13 10:33:17 -0600
commitc6dc8f16f19ceba9556ca82b4adc77e410ac44c2 (patch)
tree09ef18f3a9b0a702750b9b482a78a017fac91ad2 /doc/posix-functions/getcwd.texi
parent4104cd4f7746f8ba7e75e3292c78c2c528b0c88a (diff)
downloadgnulib-c6dc8f16f19ceba9556ca82b4adc77e410ac44c2.tar.gz
getcwd-lgpl: relax test for FreeBSD
getcwd(NULL, 1) mallocs a larger buffer on BSD, rather than failing with ERANGE as on glibc. This behavior difference is not worth coding around, as it is an uncommon use of getcwd in the first place. * doc/posix-functions/getcwd.texi (getcwd): Document portability issue. * tests/test-getcwd-lgpl.c (main): Relax test. Reported by Matthias Bolte. Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'doc/posix-functions/getcwd.texi')
-rw-r--r--doc/posix-functions/getcwd.texi10
1 files changed, 8 insertions, 2 deletions
diff --git a/doc/posix-functions/getcwd.texi b/doc/posix-functions/getcwd.texi
index 1f6dd187d2..a49a8990dc 100644
--- a/doc/posix-functions/getcwd.texi
+++ b/doc/posix-functions/getcwd.texi
@@ -11,8 +11,7 @@ Portability problems fixed by either Gnulib module @code{getcwd} or
@itemize
@item
On glibc platforms, @code{getcwd (NULL, n)} allocates memory for the result.
-On some other platforms, this call is not allowed. Conversely, mingw fails
-to honor non-zero @code{n}.
+On some other platforms, this call is not allowed.
@item
On some platforms, the prototype for @code{getcwd} uses @code{int}
instead of @code{size_t} for the size argument:
@@ -30,4 +29,11 @@ correctly on some platforms.
Portability problems not fixed by Gnulib:
@itemize
+@item
+When using @code{getcwd(NULL, nonzero)}, some platforms, such as glibc
+or cygwin, allocate exactly @code{nonzero} bytes and fail with
+@code{ERANGE} if it was not big enough, while other platforms, such as
+FreeBSD or mingw, ignore the size argument and allocate whatever size
+is necessary. If this call succeeds, an application cannot portably
+access beyond the string length of the result.
@end itemize