summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-11-01 03:58:14 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-11-01 03:58:14 +0100
commit5a56c0adf2c63602b819d052644cb14caf732438 (patch)
tree37c6725a0ed7cfcf9708de335e21b52fc2a46c20 /source3
parentdf766a303a9114969caa7c51e5e0e29d8e0e3850 (diff)
downloadsamba-5a56c0adf2c63602b819d052644cb14caf732438.tar.gz
samba-5a56c0adf2c63602b819d052644cb14caf732438.tar.bz2
samba-5a56c0adf2c63602b819d052644cb14caf732438.zip
Use dup2() replacement from libreplace.
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/lib/debug.c4
-rw-r--r--source3/lib/smbrun.c4
-rw-r--r--source3/lib/system.c10
-rw-r--r--source3/smbd/chgpasswd.c6
5 files changed, 7 insertions, 18 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index c6609be5d6..6e0bde3a14 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1054,7 +1054,6 @@ void *sys_dlopen(const char *name, int flags);
void *sys_dlsym(void *handle, const char *symbol);
int sys_dlclose (void *handle);
const char *sys_dlerror(void);
-int sys_dup2(int oldfd, int newfd) ;
ssize_t sys_getxattr (const char *path, const char *name, void *value, size_t size);
ssize_t sys_lgetxattr (const char *path, const char *name, void *value, size_t size);
ssize_t sys_fgetxattr (int filedes, const char *name, void *value, size_t size);
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index be2707b595..986dff48d7 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -680,8 +680,8 @@ bool reopen_logs( void )
force_check_log_size();
(void)umask(oldumask);
- /* Take over stderr to catch ouput into logs */
- if (dbf && sys_dup2(x_fileno(dbf), 2) == -1) {
+ /* Take over stderr to catch output into logs */
+ if (dbf && dup2(x_fileno(dbf), 2) == -1) {
close_low_fds(True); /* Close stderr too, if dup2 can't point it
at the logfile */
}
diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c
index 515fcd75c2..31990713b8 100644
--- a/source3/lib/smbrun.c
+++ b/source3/lib/smbrun.c
@@ -153,7 +153,7 @@ static int smbrun_internal(const char *cmd, int *outfd, bool sanitize)
/* point our stdout at the file we want output to go into */
if (outfd) {
close(1);
- if (sys_dup2(*outfd,1) != 1) {
+ if (dup2(*outfd,1) != 1) {
DEBUG(2,("Failed to create stdout file descriptor\n"));
close(*outfd);
exit(80);
@@ -305,7 +305,7 @@ int smbrunsecret(const char *cmd, const char *secret)
close(ifd[1]);
close(0);
- if (sys_dup2(ifd[0], 0) != 0) {
+ if (dup2(ifd[0], 0) != 0) {
DEBUG(2,("Failed to create stdin file descriptor\n"));
close(ifd[0]);
exit(80);
diff --git a/source3/lib/system.c b/source3/lib/system.c
index eabb6d6dc4..6d33a1c360 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -1343,16 +1343,6 @@ const char *sys_dlerror(void)
#endif
}
-int sys_dup2(int oldfd, int newfd)
-{
-#if defined(HAVE_DUP2)
- return dup2(oldfd, newfd);
-#else
- errno = ENOSYS;
- return -1;
-#endif
-}
-
/**************************************************************************
Wrapper for Admin Logs.
****************************************************************************/
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index 64a4311256..e6d2bbf59f 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -184,17 +184,17 @@ static int dochild(int master, const char *slavedev, const struct passwd *pass,
/* Make slave stdin/out/err of child. */
- if (sys_dup2(slave, STDIN_FILENO) != STDIN_FILENO)
+ if (dup2(slave, STDIN_FILENO) != STDIN_FILENO)
{
DEBUG(3, ("Could not re-direct stdin\n"));
return (False);
}
- if (sys_dup2(slave, STDOUT_FILENO) != STDOUT_FILENO)
+ if (dup2(slave, STDOUT_FILENO) != STDOUT_FILENO)
{
DEBUG(3, ("Could not re-direct stdout\n"));
return (False);
}
- if (sys_dup2(slave, STDERR_FILENO) != STDERR_FILENO)
+ if (dup2(slave, STDERR_FILENO) != STDERR_FILENO)
{
DEBUG(3, ("Could not re-direct stderr\n"));
return (False);