summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2005-06-21 11:27:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:57:21 -0500
commitb0b983cc60f51395c4f19d185c4e3b8b1e9dce1b (patch)
tree34997187b9e8022f8222221f8d63bfcd8a3dadc3
parentbf28978a70b9abbfb09b44325c712d110b590a33 (diff)
downloadsamba-b0b983cc60f51395c4f19d185c4e3b8b1e9dce1b.tar.gz
samba-b0b983cc60f51395c4f19d185c4e3b8b1e9dce1b.tar.bz2
samba-b0b983cc60f51395c4f19d185c4e3b8b1e9dce1b.zip
r7807: Allow to touch mtime in vfs-recycle with
recycle:touch_mtime = true Guenther (This used to be commit fa8e2c4b04786a77356bb4e310d59d7475d8bd87)
-rw-r--r--source3/modules/vfs_recycle.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c
index 770dc2f40a..0abcc29bcf 100644
--- a/source3/modules/vfs_recycle.c
+++ b/source3/modules/vfs_recycle.c
@@ -109,6 +109,17 @@ static BOOL recycle_touch(vfs_handle_struct *handle)
return ret;
}
+static BOOL recycle_touch_mtime(vfs_handle_struct *handle)
+{
+ BOOL ret;
+
+ ret = lp_parm_bool(SNUM(handle->conn), "recycle", "touch_mtime", False);
+
+ DEBUG(10, ("recycle: touch_mtime = %s\n", ret?"True":"False"));
+
+ return ret;
+}
+
static const char **recycle_exclude(vfs_handle_struct *handle)
{
const char **tmp_lp;
@@ -317,9 +328,9 @@ static BOOL matchparam(const char **haystack_list, const char *needle)
}
/**
- * Touch access date
+ * Touch access or modify date
**/
-static void recycle_do_touch(vfs_handle_struct *handle, const char *fname)
+static void recycle_do_touch(vfs_handle_struct *handle, const char *fname, BOOL touch_mtime)
{
SMB_STRUCT_STAT st;
struct utimbuf tb;
@@ -331,7 +342,7 @@ static void recycle_do_touch(vfs_handle_struct *handle, const char *fname)
}
currtime = time(&currtime);
tb.actime = currtime;
- tb.modtime = st.st_mtime;
+ tb.modtime = touch_mtime ? currtime : st.st_mtime;
if (SMB_VFS_NEXT_UTIME(handle, handle->conn, fname, &tb) == -1 ) {
DEBUG(0, ("recycle: touching %s failed, reason = %s\n", fname, strerror(errno)));
@@ -490,8 +501,8 @@ static int recycle_unlink(vfs_handle_struct *handle, connection_struct *conn, co
}
/* touch access date of moved file */
- if (recycle_touch(handle) == True )
- recycle_do_touch(handle, final_name);
+ if (recycle_touch(handle) == True || recycle_touch_mtime(handle))
+ recycle_do_touch(handle, final_name, recycle_touch_mtime(handle));
done:
SAFE_FREE(path_name);