From a6d537bb6cec25eb27cf8884ca5e3362a86818b3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Nov 2008 03:42:27 +0100 Subject: Move sys_realpath() to libreplace. --- lib/replace/README | 1 + lib/replace/libreplace.m4 | 2 +- lib/replace/replace.c | 11 +++++++++++ lib/replace/replace.h | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/replace') 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 ]) AC_HAVE_DECL(setresgid, [#include ]) AC_HAVE_DECL(errno, [#include ]) 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); -- cgit