summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-11-01 03:35:58 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-11-01 03:35:58 +0100
commite8cda43e171c1aa8f4b858228e715290d400691c (patch)
tree38f8fec8ef93ba577920e3d8abf276771ba6caf5
parentdbda9adfaf388f62cf359ea728ae303d81df81a9 (diff)
downloadsamba-e8cda43e171c1aa8f4b858228e715290d400691c.tar.gz
samba-e8cda43e171c1aa8f4b858228e715290d400691c.tar.bz2
samba-e8cda43e171c1aa8f4b858228e715290d400691c.zip
Move sys_symlink() to libreplace.
-rw-r--r--lib/replace/README1
-rw-r--r--lib/replace/libreplace.m42
-rw-r--r--lib/replace/replace.c8
-rw-r--r--lib/replace/replace.h6
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/lib/system.c14
-rw-r--r--source3/modules/vfs_default.c4
7 files changed, 18 insertions, 19 deletions
diff --git a/lib/replace/README b/lib/replace/README
index ed0b866e85..f189e8716f 100644
--- a/lib/replace/README
+++ b/lib/replace/README
@@ -67,6 +67,7 @@ utime
utimes
link
readlink
+symlink
Types:
bool
diff --git a/lib/replace/libreplace.m4 b/lib/replace/libreplace.m4
index 64df4ec575..a93a9dad45 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 readlink)
+AC_CHECK_FUNCS(isatty chown link readlink symlink)
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 00a205d472..37705b93cd 100644
--- a/lib/replace/replace.c
+++ b/lib/replace/replace.c
@@ -642,3 +642,11 @@ int rep_readlink(const char *path, char *buf, size_t bufsiz)
return -1;
}
#endif
+
+#ifndef HAVE_SYMLINK
+int rep_symlink(const char *oldpath, const char *newpath)
+{
+ errno = ENOSYS;
+ return -1;
+}
+#endif
diff --git a/lib/replace/replace.h b/lib/replace/replace.h
index fe01a8613e..f56c5b0dc9 100644
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -230,6 +230,12 @@ int rep_link(const char *oldpath, const char *newpath);
int rep_readlink(const char *path, char *buf, size_t bufsize);
#endif
+#ifndef HAVE_SYMLINK
+#define symlink rep_symlink
+int rep_symlink(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 a731e9ef48..7e6f608896 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1003,8 +1003,6 @@ int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev);
char *sys_realpath(const char *path, char *resolved_path);
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_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 ac64954107..e2ed11d450 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -581,20 +581,6 @@ char *sys_getwd(char *s)
}
/*******************************************************************
-system wrapper for symlink
-********************************************************************/
-
-int sys_symlink(const char *oldpath, const char *newpath)
-{
-#ifndef HAVE_SYMLINK
- errno = ENOSYS;
- return -1;
-#else
- return symlink(oldpath, newpath);
-#endif
-}
-
-/*******************************************************************
Wrapper for lchown.
********************************************************************/
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index f47ff8fdfc..37b0fc392b 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -869,7 +869,7 @@ static int vfswrap_symlink(vfs_handle_struct *handle, const char *oldpath, cons
int result;
START_PROFILE(syscall_symlink);
- result = sys_symlink(oldpath, newpath);
+ result = symlink(oldpath, newpath);
END_PROFILE(syscall_symlink);
return result;
}
@@ -879,7 +879,7 @@ static int vfswrap_readlink(vfs_handle_struct *handle, const char *path, char *
int result;
START_PROFILE(syscall_readlink);
- result = sys_readlink(path, buf, bufsiz);
+ result = readlink(path, buf, bufsiz);
END_PROFILE(syscall_readlink);
return result;
}