summaryrefslogtreecommitdiff
path: root/source3/lib/replace/replace.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-05-07 13:10:31 +0200
committerStefan Metzmacher <metze@samba.org>2008-05-16 08:51:46 +0200
commitdb4ab7aae3b44b22b70013f13da370b74d429553 (patch)
tree54d56e9d255c58ac444788546d0afeda0e71274c /source3/lib/replace/replace.c
parent70883ec3032b4c9f6c4f5f39dd6d43b9e2c79d48 (diff)
downloadsamba-db4ab7aae3b44b22b70013f13da370b74d429553.tar.gz
samba-db4ab7aae3b44b22b70013f13da370b74d429553.tar.bz2
samba-db4ab7aae3b44b22b70013f13da370b74d429553.zip
libreplace: always provide utime() and utimes()
I'd like to also provide futimes(), but it seems that some systems doesn't support a it at kernel level. If someone knows how to write a portable replacement for futimes() please tell me... metze (cherry picked from commit a9604fe4a323dccb537cf02ea7594437b4995803) (This used to be commit 8a241cf150fba787c82cbcb03730083ced442fbb)
Diffstat (limited to 'source3/lib/replace/replace.c')
-rw-r--r--source3/lib/replace/replace.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source3/lib/replace/replace.c b/source3/lib/replace/replace.c
index 443da2ab24..2c3f14c2df 100644
--- a/source3/lib/replace/replace.c
+++ b/source3/lib/replace/replace.c
@@ -584,3 +584,30 @@ int rep_unsetenv(const char *name)
return 0;
}
#endif
+
+#ifndef HAVE_UTIME
+int rep_utime(const char *filename, const struct utimbuf *buf)
+{
+ errno = ENOSYS;
+ return -1;
+}
+#endif
+
+#ifndef HAVE_UTIMES
+int rep_utimes(const char *filename, const struct timeval tv[2])
+{
+ struct utimbuf u;
+
+ u.actime = tv[0].tv_sec;
+ if (tv[0].tv_usec > 500000) {
+ u.actime += 1;
+ }
+
+ u.modtime = tv[1].tv_sec;
+ if (tv[1].tv_usec > 500000) {
+ u.modtime += 1;
+ }
+
+ return utime(filename, &u);
+}
+#endif