From: Jelmer Vernooij Date: Sat, 1 Nov 2008 02:30:47 +0000 (+0100) Subject: Move sys_link to libreplace. X-Git-Tag: samba-4.0.0alpha6~585^2~7 X-Git-Url: http://git.samba.org/samba.git/?a=commitdiff_plain;h=bbbe6ab72284c78c095babd875070aaac8c477dd;p=samba.git Move sys_link to libreplace. --- diff --git a/lib/replace/README b/lib/replace/README index a63409580ca..8dcc1006258 100644 --- a/lib/replace/README +++ b/lib/replace/README @@ -65,6 +65,7 @@ getifaddrs freeifaddrs utime utimes +link Types: bool diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4 index c802525eed1..b58575d33d0 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) +AC_CHECK_FUNCS(isatty chown link) 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 74af75ebf12..adf79321073 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -627,3 +627,11 @@ int rep_chown(const char *fname, uid_t uid, gid_t gid) } #endif +#ifndef HAVE_LINK +int rep_link(const char *oldpath, const char *newpath) +{ + errno = ENOSYS; + return -1; +} +#endif + diff --git a/lib/replace/replace.h b/lib/replace/replace.h index 2518d40a65d..7d8bbec18ff 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -220,6 +220,11 @@ int rep_setegid(gid_t); int rep_chown(const char *path, uid_t uid, gid_t gid); #endif +#ifndef HAVE_LINK +#define link rep_link +int rep_link(const char *oldpath, const char *newpath); +#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 41ca5a00869..14d0c2e8dd3 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1006,7 +1006,6 @@ 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_chown(const char *fname,uid_t uid,gid_t gid); 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 7f5f5722550..cb3551c11e4 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -608,20 +608,6 @@ int sys_readlink(const char *path, char *buf, size_t bufsiz) #endif } -/******************************************************************* -system wrapper for link -********************************************************************/ - -int sys_link(const char *oldpath, const char *newpath) -{ -#ifndef HAVE_LINK - errno = ENOSYS; - return -1; -#else - return link(oldpath, newpath); -#endif -} - /******************************************************************* Wrapper for lchown. ********************************************************************/ diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 808adf3b282..f47ff8fdfc0 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -889,7 +889,7 @@ static int vfswrap_link(vfs_handle_struct *handle, const char *oldpath, const c int result; START_PROFILE(syscall_link); - result = sys_link(oldpath, newpath); + result = link(oldpath, newpath); END_PROFILE(syscall_link); return result; }