summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-11-01 03:33:39 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-11-01 03:33:39 +0100
commitdbda9adfaf388f62cf359ea728ae303d81df81a9 (patch)
treef6f75230432f02af3bcbffa59adc55e6b6c95244
parentbbbe6ab72284c78c095babd875070aaac8c477dd (diff)
downloadsamba-dbda9adfaf388f62cf359ea728ae303d81df81a9.tar.gz
samba-dbda9adfaf388f62cf359ea728ae303d81df81a9.tar.bz2
samba-dbda9adfaf388f62cf359ea728ae303d81df81a9.zip
Move sys_readlink() to libreplace.
-rw-r--r--lib/replace/README1
-rw-r--r--lib/replace/libreplace.m42
-rw-r--r--lib/replace/replace.c7
-rw-r--r--lib/replace/replace.h5
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/lib/system.c14
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 <unistd.h>])
AC_HAVE_DECL(setresgid, [#include <unistd.h>])
AC_HAVE_DECL(errno, [#include <errno.h>])
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
@@ -595,20 +595,6 @@ int sys_symlink(const char *oldpath, const char *newpath)
}
/*******************************************************************
-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.
********************************************************************/