summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2018-05-02 15:03:48 +0200
committerOndrej Holy <oholy@redhat.com>2018-05-14 14:07:38 +0200
commit4967b7a27ac52026150d366ea77f6c42f29b50b3 (patch)
treed5201d458b94b477b9814bf641b24c1b1624b7e1
parentf5437d96d8f515ca176da93894c7b332657cb352 (diff)
downloadgvfs-4967b7a27ac52026150d366ea77f6c42f29b50b3.tar.gz
smb: Add workaround to fix removal of non-empty dir
smbc_rmdir returns 0 for non-empty dir currently even if the dir has not been removed. Add workaround and return G_IO_ERROR_NOT_EMPTY in this case. https://bugzilla.gnome.org/show_bug.cgi?id=792147
-rw-r--r--daemon/gvfsbackendsmb.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index 147872d1..d4944197 100644
--- a/daemon/gvfsbackendsmb.c
+++ b/daemon/gvfsbackendsmb.c
@@ -1936,7 +1936,19 @@ do_delete (GVfsBackend *backend,
}
if (S_ISDIR (statbuf.st_mode))
- res = smbc_rmdir (op_backend->smb_context, uri);
+ {
+ res = smbc_rmdir (op_backend->smb_context, uri);
+
+ /* We can't rely on libsmbclient reporting ENOTEMPTY, let's verify that
+ * the dir has been really removed:
+ * https://bugzilla.samba.org/show_bug.cgi?id=13204
+ */
+ if (res == 0 && smbc_stat (op_backend->smb_context, uri, &statbuf) == 0)
+ {
+ res = -1;
+ errno = ENOTEMPTY;
+ }
+ }
else
res = smbc_unlink (op_backend->smb_context, uri);
errsv = errno;