aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2011-04-10 09:00:46 -0700
committerPaul Eggert2011-04-10 09:00:46 -0700
commit69d9a57ddcfb6d9b51ce321bd2557881c6784151 (patch)
tree6e603216367a9fce7f9c8c68a9da4a2277d2cab8
parent4073e537492ac700f926d1ed0f27d6160a142ae4 (diff)
downloademacs-69d9a57ddcfb6d9b51ce321bd2557881c6784151.tar.gz
emacs-69d9a57ddcfb6d9b51ce321bd2557881c6784151.zip
Merge from gnulib.
-rw-r--r--lib/careadlinkat.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c
index 01883db9ce5..e2909c766d5 100644
--- a/lib/careadlinkat.c
+++ b/lib/careadlinkat.c
@@ -22,10 +22,9 @@
22 22
23#include "careadlinkat.h" 23#include "careadlinkat.h"
24 24
25#include "allocator.h"
26
27#include <errno.h> 25#include <errno.h>
28#include <limits.h> 26#include <limits.h>
27#include <stdlib.h>
29#include <string.h> 28#include <string.h>
30#include <unistd.h> 29#include <unistd.h>
31 30
@@ -38,15 +37,20 @@
38# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2)) 37# define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
39#endif 38#endif
40 39
40#include "allocator.h"
41
41#if ! HAVE_READLINKAT 42#if ! HAVE_READLINKAT
42/* Ignore FD. Get the symbolic link value of FILENAME and put it into 43/* Get the symbolic link value of FILENAME and put it into BUFFER, with
43 BUFFER, with size BUFFER_SIZE. This function acts like readlink 44 size BUFFER_SIZE. This function acts like readlink but has
44 but has readlinkat's signature. */ 45 readlinkat's signature. */
45ssize_t 46ssize_t
46careadlinkatcwd (int fd, char const *filename, char *buffer, 47careadlinkatcwd (int fd, char const *filename, char *buffer,
47 size_t buffer_size) 48 size_t buffer_size)
48{ 49{
49 (void) fd; 50 /* FD must be AT_FDCWD here, otherwise the caller is using this
51 function in contexts for which it was not meant for. */
52 if (fd != AT_FDCWD)
53 abort ();
50 return readlink (filename, buffer, buffer_size); 54 return readlink (filename, buffer, buffer_size);
51} 55}
52#endif 56#endif