svn commit: samba r23691 - in branches: SAMBA_3_0/source/modules
SAMBA_3_0_26/source/modules
idra at samba.org
idra at samba.org
Tue Jul 3 23:34:02 GMT 2007
Author: idra
Date: 2007-07-03 23:34:01 +0000 (Tue, 03 Jul 2007)
New Revision: 23691
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23691
Log:
fix for bug on touching files as described here:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=243897
Modified:
branches/SAMBA_3_0/source/modules/vfs_recycle.c
branches/SAMBA_3_0_26/source/modules/vfs_recycle.c
Changeset:
Modified: branches/SAMBA_3_0/source/modules/vfs_recycle.c
===================================================================
--- branches/SAMBA_3_0/source/modules/vfs_recycle.c 2007-07-03 20:00:02 UTC (rev 23690)
+++ branches/SAMBA_3_0/source/modules/vfs_recycle.c 2007-07-03 23:34:01 UTC (rev 23691)
@@ -386,20 +386,28 @@
/**
* Touch access or modify date
**/
-static void recycle_do_touch(vfs_handle_struct *handle, const char *fname, BOOL touch_mtime)
+static void recycle_do_touch(vfs_handle_struct *handle, const char *fname,
+ BOOL touch_mtime)
{
SMB_STRUCT_STAT st;
struct timespec ts[2];
-
+ int status, err;
+
if (SMB_VFS_NEXT_STAT(handle, fname, &st) != 0) {
- DEBUG(0,("recycle: stat for %s returned %s\n", fname, strerror(errno)));
+ DEBUG(0,("recycle: stat for %s returned %s\n",
+ fname, strerror(errno)));
return;
}
ts[0] = timespec_current(); /* atime */
ts[1] = touch_mtime ? ts[0] : get_mtimespec(&st); /* mtime */
- if (SMB_VFS_NEXT_NTIMES(handle, fname, ts) == -1 ) {
- DEBUG(0, ("recycle: touching %s failed, reason = %s\n", fname, strerror(errno)));
+ become_root();
+ status = SMB_VFS_NEXT_NTIMES(handle, fname, ts);
+ err = errno;
+ unbecome_root();
+ if (status == -1 ) {
+ DEBUG(0, ("recycle: touching %s failed, reason = %s\n",
+ fname, strerror(err)));
}
}
Modified: branches/SAMBA_3_0_26/source/modules/vfs_recycle.c
===================================================================
--- branches/SAMBA_3_0_26/source/modules/vfs_recycle.c 2007-07-03 20:00:02 UTC (rev 23690)
+++ branches/SAMBA_3_0_26/source/modules/vfs_recycle.c 2007-07-03 23:34:01 UTC (rev 23691)
@@ -386,20 +386,28 @@
/**
* Touch access or modify date
**/
-static void recycle_do_touch(vfs_handle_struct *handle, const char *fname, BOOL touch_mtime)
+static void recycle_do_touch(vfs_handle_struct *handle, const char *fname,
+ BOOL touch_mtime)
{
SMB_STRUCT_STAT st;
struct timespec ts[2];
-
+ int status, err;
+
if (SMB_VFS_NEXT_STAT(handle, fname, &st) != 0) {
- DEBUG(0,("recycle: stat for %s returned %s\n", fname, strerror(errno)));
+ DEBUG(0,("recycle: stat for %s returned %s\n",
+ fname, strerror(errno)));
return;
}
ts[0] = timespec_current(); /* atime */
ts[1] = touch_mtime ? ts[0] : get_mtimespec(&st); /* mtime */
- if (SMB_VFS_NEXT_NTIMES(handle, fname, ts) == -1 ) {
- DEBUG(0, ("recycle: touching %s failed, reason = %s\n", fname, strerror(errno)));
+ become_root();
+ status = SMB_VFS_NEXT_NTIMES(handle, fname, ts);
+ err = errno;
+ unbecome_root();
+ if (status == -1 ) {
+ DEBUG(0, ("recycle: touching %s failed, reason = %s\n",
+ fname, strerror(err)));
}
}
More information about the samba-cvs
mailing list