diff options
author | Ross Lagerwall <rosslagerwall@gmail.com> | 2014-05-27 18:44:20 +0100 |
---|---|---|
committer | Ross Lagerwall <rosslagerwall@gmail.com> | 2014-05-30 07:04:17 +0100 |
commit | a2c0a4882356f6ab17d70be6e6276a88673d7257 (patch) | |
tree | 082e2266504f31ab17a1e05be3b4f38be27f2349 /daemon/gvfsbackendsmb.c | |
parent | 9be61011c012db38ea73484579375999af3c4236 (diff) | |
download | gvfs-a2c0a4882356f6ab17d70be6e6276a88673d7257.tar.gz |
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
Diffstat (limited to 'daemon/gvfsbackendsmb.c')
-rw-r--r-- | daemon/gvfsbackendsmb.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c index 2e112efd..bd82fce1 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 |