summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2008-03-17 10:57:42 +0000
committerBenjamin Otte <otte@src.gnome.org>2008-03-17 10:57:42 +0000
commitf67f95dfa4aea52658d4b8222c3ee3f476df1816 (patch)
tree85731d91bc18bd15f72df1712c994d82fcdde0a1
parentd5dc0c15baf7b04fd8ed6090abbaf1cac887b3ae (diff)
downloadgvfs-f67f95dfa4aea52658d4b8222c3ee3f476df1816.tar.gz
return G_IO_ERROR_NOT_EMPTY if we're trying to delete a non-empty
2008-03-17 Benjamin Otte <otte@gnome.org> * daemon/gvfsbackendftp.c: return G_IO_ERROR_NOT_EMPTY if we're trying to delete a non-empty directory. * hal/ghalvolumemonitor.c: (get_mount_point_for_device): remove unused variable svn path=/trunk/; revision=1664
-rw-r--r--ChangeLog8
-rw-r--r--daemon/gvfsbackendftp.c29
-rw-r--r--hal/ghalvolumemonitor.c1
3 files changed, 33 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 72947526..604ac353 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-03-17 Benjamin Otte <otte@gnome.org>
+
+ * daemon/gvfsbackendftp.c:
+ return G_IO_ERROR_NOT_EMPTY if we're trying to delete a non-empty
+ directory.
+ * hal/ghalvolumemonitor.c: (get_mount_point_for_device):
+ remove unused variable
+
2008-03-16 Christian Kellner <gicmo@gnome.org>
* AUTHORS: Forgot to mention A. Walton. Correct that.
diff --git a/daemon/gvfsbackendftp.c b/daemon/gvfsbackendftp.c
index 9292f3ba..89031f0f 100644
--- a/daemon/gvfsbackendftp.c
+++ b/daemon/gvfsbackendftp.c
@@ -237,7 +237,8 @@ ftp_connection_set_error_from_response (FtpConnection *conn, guint response)
break;
case 450: /* Requested file action not taken. File unavailable (e.g., file busy). */
case 550: /* Requested action not taken. File unavailable (e.g., file not found, no access). */
- /* FIXME: This is a lot of different errors */
+ /* FIXME: This is a lot of different errors. So we have to pretend to
+ * be smart here. */
code = G_IO_ERROR_NOT_FOUND;
msg = _("File unavailable");
break;
@@ -2134,9 +2135,29 @@ do_delete (GVfsBackend *backend,
RESPONSE_PASS_500,
"DELE %s", file);
if (STATUS_GROUP (response) == 5)
- ftp_connection_send (conn,
- 0,
- "RMD %s", file);
+ {
+ response = ftp_connection_send (conn,
+ RESPONSE_PASS_500,
+ "RMD %s", file);
+ if (response == 550)
+ {
+ const GList *files = enumerate_directory (ftp, conn, file, FALSE);
+ if (files)
+ {
+ g_static_rw_lock_reader_unlock (&ftp->directory_cache_lock);
+ g_set_error (&conn->error,
+ G_IO_ERROR,
+ G_IO_ERROR_NOT_EMPTY,
+ "%s", g_strerror (ENOTEMPTY));
+ }
+ else
+ ftp_connection_set_error_from_response (conn, response);
+ }
+ else if (STATUS_GROUP (response) == 5)
+ {
+ ftp_connection_set_error_from_response (conn, response);
+ }
+ }
gvfs_backend_ftp_purge_cache_of_file (ftp, conn, file);
g_free (file);
diff --git a/hal/ghalvolumemonitor.c b/hal/ghalvolumemonitor.c
index a577e18e..6baaaa6c 100644
--- a/hal/ghalvolumemonitor.c
+++ b/hal/ghalvolumemonitor.c
@@ -801,7 +801,6 @@ static GUnixMountPoint *
get_mount_point_for_device (HalDevice *d, GList *fstab_mount_points)
{
GList *l;
- gboolean ret;
const char *device_file;
const char *device_mount_point;