changeset 14557:1d2daac9948e

careadlinkat: Clarify specification. * lib/careadlinkat.h (careadlinkat): Clarify preadlinkat argument. (careadlinkatcwd): Add comment. * lib/careadlinkat.c (careadlinkat): Clarify preadlinkat argument.
author Bruno Haible <bruno@clisp.org>
date Sat, 09 Apr 2011 18:38:04 +0200
parents b9086e1df820
children 2fecee8e8803
files ChangeLog lib/careadlinkat.c lib/careadlinkat.h
diffstat 3 files changed, 18 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-04-09  Bruno Haible  <bruno@clisp.org>
+
+	careadlinkat: Clarify specification.
+	* lib/careadlinkat.h (careadlinkat): Clarify preadlinkat argument.
+	(careadlinkatcwd): Add comment.
+	* lib/careadlinkat.c (careadlinkat): Clarify preadlinkat argument.
+
 2011-04-09  Bruno Haible  <bruno@clisp.org>
 
 	areadlinkat: Avoid link error on many platforms.
--- a/lib/careadlinkat.c
+++ b/lib/careadlinkat.c
@@ -65,7 +65,10 @@
    the returned value if it is nonnull and is not BUFFER.  A null
    ALLOC stands for the standard allocator.
 
-   The PREADLINKAT function specifies how to read links.
+   The PREADLINKAT function specifies how to read links.  It operates
+   like POSIX readlinkat()
+   <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>
+   but can assume that its first argument is the same as FD.
 
    If successful, return the buffer address; otherwise return NULL and
    set errno.  */
--- a/lib/careadlinkat.h
+++ b/lib/careadlinkat.h
@@ -38,7 +38,10 @@
    buffer managed by ALLOC.  It is the caller's responsibility to free
    the returned value if it is nonnull and is not BUFFER.
 
-   The PREADLINKAT function specifies how to read links.
+   The PREADLINKAT function specifies how to read links.  It operates
+   like POSIX readlinkat()
+   <http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html>
+   but can assume that its first argument is the same as FD.
 
    If successful, return the buffer address; otherwise return NULL and
    set errno.  */
@@ -50,8 +53,10 @@
                                             char *, size_t));
 
 /* Suitable values for careadlinkat's FD and PREADLINKAT arguments,
-   when doing a plain readlink.  */
+   when doing a plain readlink:
+   Pass FD = AT_FDCWD and PREADLINKAT = careadlinkatcwd.  */
 #if HAVE_READLINKAT
+/* AT_FDCWD is declared in <fcntl.h>, readlinkat in <unistd.h>.  */
 # define careadlinkatcwd readlinkat
 #else
 /* Define AT_FDCWD independently, so that the careadlinkat module does