summaryrefslogtreecommitdiff
path: root/daemon
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 /daemon
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
Diffstat (limited to 'daemon')
-rw-r--r--daemon/gvfsbackendftp.c29
1 files changed, 25 insertions, 4 deletions
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);