[gvfs] smb: Give correct error when unlink fails while closing file
- From: Ross Lagerwall <rossl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] smb: Give correct error when unlink fails while closing file
- Date: Wed, 2 Apr 2014 19:20:14 +0000 (UTC)
commit 449fd42ad5d8bc717c024e51f71bd8e913009025
Author: Ross Lagerwall <rosslagerwall gmail com>
Date: Mon Mar 24 23:30:00 2014 +0000
smb: Give correct error when unlink fails while closing file
When closing a file that is overwriting another file, don't ignore the
error message when unlinking the old file. This is important when
unlinking fails due to a permission denied error but the error message
that was being returned was File Exists (from the subsequent rename).
https://bugzilla.gnome.org/show_bug.cgi?id=726998
daemon/gvfsbackendsmb.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index a673c59..af9df90 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -1482,7 +1482,16 @@ do_close_write (GVfsBackend *backend,
}
}
else
- smbc_unlink (op_backend->smb_context, handle->uri);
+ {
+ res = smbc_unlink (op_backend->smb_context, handle->uri);
+ if (res == -1)
+ {
+ errsv = errno;
+ smbc_unlink (op_backend->smb_context, handle->tmp_uri);
+ g_vfs_job_failed_from_errno (G_VFS_JOB (job), errsv);
+ goto out;
+ }
+ }
res = smbc_rename (op_backend->smb_context, handle->tmp_uri,
op_backend->smb_context, handle->uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]