[gvfs/gnome-3-28] smb: Add workaround to fix removal of non-empty dir
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-3-28] smb: Add workaround to fix removal of non-empty dir
- Date: Mon, 14 May 2018 12:10:01 +0000 (UTC)
commit 42f65062a3c72f920ba35d4fa1437c104355e207
Author: Ondrej Holy <oholy redhat com>
Date: Wed May 2 15:03:48 2018 +0200
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
daemon/gvfsbackendsmb.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c
index 147872d..d494419 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]