summaryrefslogtreecommitdiff
path: root/source3/smbwrapper
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-10-05 08:54:55 +0000
committerAndrew Tridgell <tridge@samba.org>1998-10-05 08:54:55 +0000
commit61d8534d7cd274d521ee211ac927096a465a0551 (patch)
tree8b4329273f34017dfe22e92fca3eff4b3e6e2f4e /source3/smbwrapper
parent81905488fffbf6fbdcfd8ec351566026445f9e01 (diff)
downloadsamba-61d8534d7cd274d521ee211ac927096a465a0551.tar.gz
handle systems that are missing either SYS_utime or SYS_utimes
(This used to be commit 4379f0fe48a40e1ff6b343bbcff542efbda1f4f8)
Diffstat (limited to 'source3/smbwrapper')
-rw-r--r--source3/smbwrapper/realcalls.c12
-rw-r--r--source3/smbwrapper/realcalls.h7
-rw-r--r--source3/smbwrapper/wrapped.c40
-rw-r--r--source3/smbwrapper/wrapper.h2
4 files changed, 51 insertions, 10 deletions
diff --git a/source3/smbwrapper/realcalls.c b/source3/smbwrapper/realcalls.c
index 4eb3d5e087c..a453aff3eac 100644
--- a/source3/smbwrapper/realcalls.c
+++ b/source3/smbwrapper/realcalls.c
@@ -35,3 +35,15 @@ int real_utime(const char *name, struct utimbuf *buf)
return real_utimes(name, &tv[0]);
}
#endif
+
+#ifdef REPLACE_UTIMES
+int real_utimes(const char *name, struct timeval tv[2])
+{
+ struct utimbuf buf;
+
+ buf.actime = tv[0].tv_sec;
+ buf.modtime = tv[1].tv_sec;
+
+ return real_utime(name, &buf);
+}
+#endif
diff --git a/source3/smbwrapper/realcalls.h b/source3/smbwrapper/realcalls.h
index ada2591101f..cf23aec5b2e 100644
--- a/source3/smbwrapper/realcalls.h
+++ b/source3/smbwrapper/realcalls.h
@@ -214,10 +214,15 @@
#define real_unlink(fn) (syscall(SYS_unlink, (fn)))
#define real_rmdir(fn) (syscall(SYS_rmdir, (fn)))
#define real_mkdir(fn, mode) (syscall(SYS_mkdir, (fn), (mode)))
-#define real_utimes(fn, buf) (syscall(SYS_utimes, (fn), (buf)))
#ifdef SYS_utime
#define real_utime(fn, buf) (syscall(SYS_utime, (fn), (buf)))
#else
#define REPLACE_UTIME 1
#endif
+
+#ifdef SYS_utimes
+#define real_utimes(fn, buf) (syscall(SYS_utimes, (fn), (buf)))
+#else
+#define REPLACE_UTIMES 1
+#endif
diff --git a/source3/smbwrapper/wrapped.c b/source3/smbwrapper/wrapped.c
index 7902371ec68..65550b19cc8 100644
--- a/source3/smbwrapper/wrapped.c
+++ b/source3/smbwrapper/wrapped.c
@@ -39,14 +39,28 @@
}
#ifdef HAVE__OPEN
- int _open(const char *name, int flags, mode_t mode)
+ int _open(const char *name, int flags, ...)
{
- return open(name, flags, mode);
+ va_list ap;
+ mode_t mode;
+
+ va_start(ap, flags);
+ mode = va_arg(ap, mode_t);
+ va_end(ap);
+
+ return open(name, flags, mode);
}
#elif HAVE___OPEN
- int __open(const char *name, int flags, mode_t mode)
+ int __open(const char *name, int flags, ...)
{
- return open(name, flags, mode);
+ va_list ap;
+ mode_t mode;
+
+ va_start(ap, flags);
+ mode = va_arg(ap, mode_t);
+ va_end(ap);
+
+ return open(name, flags, mode);
}
#endif
@@ -198,13 +212,25 @@
#ifdef HAVE___FCNTL
- int __fcntl(int fd, int cmd, long arg)
+ int __fcntl(int fd, int cmd, ...)
{
+ va_list ap;
+ long arg;
+ va_start(ap, cmd);
+ arg = va_arg(ap, long);
+ va_end(ap);
+
return fcntl(fd, cmd, arg);
}
#elif HAVE__FCNTL
- int _fcntl(int fd, int cmd, long arg)
+ int _fcntl(int fd, int cmd, ...)
{
+ va_list ap;
+ long arg;
+ va_start(ap, cmd);
+ arg = va_arg(ap, long);
+ va_end(ap);
+
return fcntl(fd, cmd, arg);
}
#endif
@@ -600,7 +626,7 @@
#endif
#ifdef HAVE_UTIMES
- int utimes(const char *name,void *tvp)
+ int utimes(const char *name,struct timeval tvp[2])
{
if (smbw_path(name)) {
return smbw_utimes(name, tvp);
diff --git a/source3/smbwrapper/wrapper.h b/source3/smbwrapper/wrapper.h
index 89ad3954e74..25694bd78c1 100644
--- a/source3/smbwrapper/wrapper.h
+++ b/source3/smbwrapper/wrapper.h
@@ -31,11 +31,9 @@
#include <sys/acl.h>
#endif
-#ifndef LINUX
#ifdef HAVE_SYS_FCNTL_H
#include <sys/fcntl.h>
#endif
-#endif
/* yuck! */
#define DIRP_SIZE (256 + 32)