From 66a236773eb7d9706db907339c65791355083a3d Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 9 Apr 2011 18:38:04 +0200 Subject: [PATCH] careadlinkat: Clarify specification. * lib/careadlinkat.h (careadlinkat): Clarify preadlinkat argument. (careadlinkatcwd): Add comment. * lib/careadlinkat.c (careadlinkat): Clarify preadlinkat argument. --- ChangeLog | 7 +++++++ lib/careadlinkat.c | 5 ++++- lib/careadlinkat.h | 9 +++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index af612efa96..589f7ee0a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-04-09 Bruno Haible + + 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 areadlinkat: Avoid link error on many platforms. diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c index 7a7806d121..01883db9ce 100644 --- a/lib/careadlinkat.c +++ b/lib/careadlinkat.c @@ -65,7 +65,10 @@ careadlinkatcwd (int fd, char const *filename, char *buffer, 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() + + but can assume that its first argument is the same as FD. If successful, return the buffer address; otherwise return NULL and set errno. */ diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h index be8670f2c9..4f0184bbc3 100644 --- a/lib/careadlinkat.h +++ b/lib/careadlinkat.h @@ -38,7 +38,10 @@ struct allocator; 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() + + 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 *careadlinkat (int fd, char const *filename, 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 , readlinkat in . */ # define careadlinkatcwd readlinkat #else /* Define AT_FDCWD independently, so that the careadlinkat module does -- 2.30.2