[gvfs] smb: Fail properly if set_attribute type is wrong
- From: Ross Lagerwall <rossl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] smb: Fail properly if set_attribute type is wrong
- Date: Fri, 30 May 2014 06:05:26 +0000 (UTC)
commit a2c0a4882356f6ab17d70be6e6276a88673d7257
Author: Ross Lagerwall <rosslagerwall gmail com>
Date: Tue May 27 18:44:20 2014 +0100
smb: Fail properly if set_attribute type is wrong
If given an invalid type when setting time::modified in
do_set_attribute, don't try and change the mtime after failing the job.
https://bugzilla.gnome.org/show_bug.cgi?id=730844
daemon/gvfsbackendsmb.c | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index 2e112ef..bd82fce 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -1864,7 +1864,17 @@ do_set_attribute (GVfsBackend *backend,
if (strcmp (attribute, G_FILE_ATTRIBUTE_TIME_MODIFIED) == 0)
{
- if (type != G_FILE_ATTRIBUTE_TYPE_UINT64)
+ if (type == G_FILE_ATTRIBUTE_TYPE_UINT64)
+ {
+ smbc_utimes = smbc_getFunctionUtimes (op_backend->smb_context);
+ tbuf[1].tv_sec = (*(guint64 *)value_p); /* mtime */
+ tbuf[1].tv_usec = 0;
+ /* atime = mtime (atimes are usually disabled on desktop systems) */
+ tbuf[0].tv_sec = tbuf[1].tv_sec;
+ tbuf[0].tv_usec = 0;
+ res = smbc_utimes (op_backend->smb_context, uri, &tbuf[0]);
+ }
+ else
{
g_vfs_job_failed (G_VFS_JOB (job),
G_IO_ERROR,
@@ -1872,14 +1882,6 @@ do_set_attribute (GVfsBackend *backend,
"%s",
_("Invalid attribute type (uint64 expected)"));
}
-
- smbc_utimes = smbc_getFunctionUtimes (op_backend->smb_context);
- tbuf[1].tv_sec = (*(guint64 *)value_p); /* mtime */
- tbuf[1].tv_usec = 0;
- /* atime = mtime (atimes are usually disabled on desktop systems) */
- tbuf[0].tv_sec = tbuf[1].tv_sec;
- tbuf[0].tv_usec = 0;
- res = smbc_utimes (op_backend->smb_context, uri, &tbuf[0]);
}
#if 0
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]