summaryrefslogtreecommitdiff
path: root/lib/replace
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 /lib/replace
parentbbbe6ab72284c78c095babd875070aaac8c477dd (diff)
downloadsamba-dbda9adfaf388f62cf359ea728ae303d81df81a9.tar.gz
samba-dbda9adfaf388f62cf359ea728ae303d81df81a9.tar.bz2
samba-dbda9adfaf388f62cf359ea728ae303d81df81a9.zip
Move sys_readlink() to libreplace.
Diffstat (limited to 'lib/replace')
-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
4 files changed, 14 insertions, 1 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 *);