From dbda9adfaf388f62cf359ea728ae303d81df81a9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Nov 2008 03:33:39 +0100 Subject: Move sys_readlink() to libreplace. --- lib/replace/README | 1 + lib/replace/libreplace.m4 | 2 +- lib/replace/replace.c | 7 +++++++ lib/replace/replace.h | 5 +++++ source3/include/proto.h | 1 - source3/lib/system.c | 14 -------------- 6 files changed, 14 insertions(+), 16 deletions(-) diff --git a/lib/replace/README b/lib/replace/README index 8dcc100625..ed0b866e85 100644 --- a/lib/replace/README +++ b/lib/replace/README @@ -66,6 +66,7 @@ freeifaddrs utime utimes link +readlink Types: bool diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 index b58575d33d..64df4ec575 100644 --- a/lib/replace/libreplace.m4 +++ b/lib/replace/libreplace.m4 @@ -108,7 +108,7 @@ AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror) AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename) AC_CHECK_FUNCS(waitpid strlcpy strlcat initgroups memmove strdup) AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp) -AC_CHECK_FUNCS(isatty chown link) +AC_CHECK_FUNCS(isatty chown link readlink) AC_HAVE_DECL(setresuid, [#include ]) AC_HAVE_DECL(setresgid, [#include ]) AC_HAVE_DECL(errno, [#include ]) diff --git a/lib/replace/replace.c b/lib/replace/replace.c index adf7932107..00a205d472 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -635,3 +635,10 @@ int rep_link(const char *oldpath, const char *newpath) } #endif +#ifndef HAVE_READLINK +int rep_readlink(const char *path, char *buf, size_t bufsiz) +{ + errno = ENOSYS; + return -1; +} +#endif diff --git a/lib/replace/replace.h b/lib/replace/replace.h index 7d8bbec18f..fe01a8613e 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -225,6 +225,11 @@ int rep_chown(const char *path, uid_t uid, gid_t gid); int rep_link(const char *oldpath, const char *newpath); #endif +#ifndef HAVE_READLINK +#define readlink rep_readlink +int rep_readlink(const char *path, char *buf, size_t bufsize); +#endif + #ifndef HAVE_SETLINEBUF #define setlinebuf rep_setlinebuf void rep_setlinebuf(FILE *); diff --git a/source3/include/proto.h b/source3/include/proto.h index 14d0c2e8dd..a731e9ef48 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1005,7 +1005,6 @@ int sys_waitpid(pid_t pid,int *status,int options); char *sys_getwd(char *s); int sys_symlink(const char *oldpath, const char *newpath); int sys_readlink(const char *path, char *buf, size_t bufsiz); -int sys_link(const char *oldpath, const char *newpath); int sys_lchown(const char *fname,uid_t uid,gid_t gid); int sys_chroot(const char *dname); void set_effective_capability(enum smbd_capability capability); diff --git a/source3/lib/system.c b/source3/lib/system.c index cb3551c11e..ac64954107 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -594,20 +594,6 @@ int sys_symlink(const char *oldpath, const char *newpath) #endif } -/******************************************************************* -system wrapper for readlink -********************************************************************/ - -int sys_readlink(const char *path, char *buf, size_t bufsiz) -{ -#ifndef HAVE_READLINK - errno = ENOSYS; - return -1; -#else - return readlink(path, buf, bufsiz); -#endif -} - /******************************************************************* Wrapper for lchown. ********************************************************************/ -- cgit