From a346370d582ed9be5e434f955c049e75abc37c28 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 24 Apr 2006 17:01:40 +0000 Subject: * posix/bits/unistd.h (__readlinkat_chk): New prototype. (__readlinkat_alias): New alias. (readlinkat): New inline function. * include/unistd.h (readlinkat): Add libc_hidden_proto. * sysdeps/unix/sysv/linux/readlinkat.c (readlinkat): Add libc_hidden_def. * io/readlinkat.c (readlinkat): Likewise. * debug/readlinkat_chk.c: New file. * debug/Makefile (routines): Add readlinkat_chk. * debug/Versions (libc): Export __readlinkat_chk@@GLIBC_2.5. * debug/tst-chk1.c (do_test): Add readlinkat tests. * nis/nss_nisplus/nisplus-netgrp.c: Cleanups. code is possible. Move compatibility code in .text.compat section. over gaih array. There is only one function to call in the moment. --- posix/bits/unistd.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'posix') diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h index d461108e53..96f26d5482 100644 --- a/posix/bits/unistd.h +++ b/posix/bits/unistd.h @@ -100,6 +100,28 @@ __NTH (readlink (__const char *__restrict __path, char *__restrict __buf, } #endif +#ifdef __USE_ATFILE +extern ssize_t __readlinkat_chk (int __fd, __const char *__restrict __path, + char *__restrict __buf, size_t __len, + size_t __buflen) + __THROW __nonnull ((2, 3)) __wur; +extern ssize_t __REDIRECT_NTH (__readlinkat_alias, + (int __fd, __const char *__restrict __path, + char *__restrict __buf, size_t __len), + readlinkat) + __nonnull ((2, 3)) __wur; + +extern __always_inline __nonnull ((2, 3)) __wur ssize_t +__NTH (readlinkat (int __fd, __const char *__restrict __path, + char *__restrict __buf, size_t __len)) +{ + if (__bos (__buf) != (size_t) -1 + && (!__builtin_constant_p (__len) || __len > __bos (__buf))) + return __readlinkat_chk (__fd, __path, __buf, __len, __bos (__buf)); + return __readlinkat_alias (__fd, __path, __buf, __len); +} +#endif + extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen) __THROW __wur; extern char *__REDIRECT_NTH (__getcwd_alias, -- cgit v1.2.3