summaryrefslogtreecommitdiff
path: root/lib/replace
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-11-01 03:42:27 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-11-01 03:42:27 +0100
commita6d537bb6cec25eb27cf8884ca5e3362a86818b3 (patch)
treeacac8aa6554cd6910ec00716b2b3e40bbe4b4fe4 /lib/replace
parent38d67363aca81b970717c58b07e04396ae9dfd9f (diff)
downloadsamba-a6d537bb6cec25eb27cf8884ca5e3362a86818b3.tar.gz
samba-a6d537bb6cec25eb27cf8884ca5e3362a86818b3.tar.bz2
samba-a6d537bb6cec25eb27cf8884ca5e3362a86818b3.zip
Move sys_realpath() 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.c11
-rw-r--r--lib/replace/replace.h5
4 files changed, 18 insertions, 1 deletions
diff --git a/lib/replace/README b/lib/replace/README
index 1005281a6b..c1cb2d0270 100644
--- a/lib/replace/README
+++ b/lib/replace/README
@@ -69,6 +69,7 @@ utimes
link
readlink
symlink
+realpath
Types:
bool
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index cc9be162ac..c67fa66f5c 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 lchown link readlink symlink)
+AC_CHECK_FUNCS(isatty chown lchown link readlink symlink realpath)
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 f4faef992a..d757a0154e 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -658,3 +658,14 @@ int rep_lchown(const char *fname,uid_t uid,gid_t gid)
return -1;
}
#endif
+
+#ifndef HAVE_REALPATH
+char *rep_realpath(const char *path, char *resolved_path)
+{
+ /* As realpath is not a system call we can't return ENOSYS. */
+ errno = EINVAL;
+ return NULL;
+}
+#endif
+
+
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index b81bf5c576..8d0dd57064 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -235,6 +235,11 @@ int rep_readlink(const char *path, char *buf, size_t bufsize);
int rep_symlink(const char *oldpath, const char *newpath);
#endif
+#ifndef HAVE_REALPATH
+#define realpath rep_realpath
+char *rep_realpath(const char *path, char *resolved_path);
+#endif
+
#ifndef HAVE_LCHOWN
#define lchown rep_lchown
int rep_lchown(const char *fname,uid_t uid,gid_t gid);