careadlinkat: Avoid mismatch between ssize_t and int.
authorBruno Haible <bruno@clisp.org>
Mon, 6 Jun 2011 09:01:52 +0000 (11:01 +0200)
committerIan Beckwith <ianb@erislabs.net>
Thu, 9 Jun 2011 23:46:46 +0000 (00:46 +0100)
* lib/careadlinkat.h (careadlinkatcwd): Declare as a function always.
* lib/careadlinkat.c (careadlinkatcwd): Define always.
(cherry picked from commit 3f9fff25ea73b1a9b168d691d205d9fbb32f5d16)

ChangeLog
lib/careadlinkat.c
lib/careadlinkat.h

index f50db35..3702953 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-06  Bruno Haible  <bruno@clisp.org>
+
+       careadlinkat: Avoid mismatch between ssize_t and int.
+       * lib/careadlinkat.h (careadlinkatcwd): Declare as a function always.
+       * lib/careadlinkat.c (careadlinkatcwd): Define always.
+
 2011-06-05  Bruno Haible  <bruno@clisp.org>
 
        ansi-c++-opt: Interoperability with libtool.
index e2909c7..0b8f74e 100644 (file)
@@ -39,7 +39,6 @@
 
 #include "allocator.h"
 
-#if ! HAVE_READLINKAT
 /* Get the symbolic link value of FILENAME and put it into BUFFER, with
    size BUFFER_SIZE.  This function acts like readlink  but has
    readlinkat's signature.  */
@@ -53,7 +52,6 @@ careadlinkatcwd (int fd, char const *filename, char *buffer,
     abort ();
   return readlink (filename, buffer, buffer_size);
 }
-#endif
 
 /* Assuming the current directory is FD, get the symbolic link value
    of FILENAME as a null-terminated string and put it into a buffer.
index 4f0184b..6576fb2 100644 (file)
@@ -56,8 +56,7 @@ char *careadlinkat (int fd, char const *filename,
    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
+/* AT_FDCWD is declared in <fcntl.h>.  */
 #else
 /* Define AT_FDCWD independently, so that the careadlinkat module does
    not depend on the fcntl-h module.  The value does not matter, since
@@ -66,8 +65,8 @@ char *careadlinkat (int fd, char const *filename,
 # ifndef AT_FDCWD
 #  define AT_FDCWD (-3041965)
 # endif
+#endif
 ssize_t careadlinkatcwd (int fd, char const *filename,
                          char *buffer, size_t buffer_size);
-#endif
 
 #endif /* _GL_CAREADLINKAT_H */