path for #304022: sftp-method confuse SSH2_FX and GNOME_VFS codes



Hi,


The bug http://bugzilla.gnome.org/show_bug.cgi?id=304022 is about
gnome_vfs_async_open_uri returning GNOME_VFS_ERROR_EOF instead of
SSH2_FX_NO_SUCH_FILE with the sftp method.

This is because the code does:

"sftp_res = iobuf_read_handle (conn->in_fd, &sftp_handle, id, (guint32
*)&sftp_handle_len);

if (sftp_res == SSH2_FX_OK) {
...
return sftp_status_to_vfs_result (sftp_res);"

but iobuf_read_handle () returns a GnomeVFSResult, so the
comparaison/conversion are wrong. The patch fixes the issue.


Cheers,

Sebastien Bacher
--- modules/sftp-method.c.orig	2005-07-17 22:29:51.000000000 +0200
+++ modules/sftp-method.c	2005-07-17 22:12:43.000000000 +0200
@@ -1790,7 +1790,7 @@
 	
 	sftp_res = iobuf_read_handle (conn->in_fd, &sftp_handle, id, (guint32 *)&sftp_handle_len);
 
-	if (sftp_res == SSH2_FX_OK) {
+	if (sftp_res == GNOME_VFS_OK) {
 		handle = g_new0 (SftpOpenHandle, 1);
 		handle->sftp_handle = sftp_handle;
 		handle->sftp_handle_len = sftp_handle_len;
@@ -1808,7 +1808,7 @@
 		sftp_connection_unlock (conn);
 
 		DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", __FUNCTION__));
-		return sftp_status_to_vfs_result (sftp_res);
+		return sftp_res;
 	}
 }
 
@@ -1878,7 +1878,7 @@
 	sftp_res = iobuf_read_handle (conn->in_fd, &sftp_handle, id, &sftp_handle_len);
 
 
-	if (sftp_res == SSH2_FX_OK) {
+	if (sftp_res == GNOME_VFS_OK) {
 		handle = g_new0 (SftpOpenHandle, 1);
 		handle->sftp_handle = sftp_handle;
 		handle->sftp_handle_len = sftp_handle_len;
@@ -1896,7 +1896,7 @@
 		sftp_connection_unlock (conn);
 		
 		DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", __FUNCTION__));
-		return sftp_status_to_vfs_result (sftp_res);
+		return sftp_res;
 	}
 }
 
@@ -2450,7 +2450,7 @@
 
 	DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Result is %d", __FUNCTION__, sftp_res));
 
-	if (sftp_res == SSH2_FX_OK) {
+	if (sftp_res == GNOME_VFS_OK) {
 		handle = g_new0 (SftpOpenHandle, 1);
 		handle->sftp_handle = sftp_handle;
 		handle->sftp_handle_len = sftp_handle_len;
@@ -2469,15 +2469,15 @@
 		return GNOME_VFS_OK;
 	} else {
 		/* For some reason, some servers report EOF when the directory doesn't exist. *shrug* */
-		if (sftp_res == SSH2_FX_EOF)
-			sftp_res = SSH2_FX_NO_SUCH_FILE;
+		if (sftp_res == GNOME_VFS_ERROR_EOF)
+			sftp_res = GNOME_VFS_ERROR_NOT_FOUND;
 
 		sftp_connection_unref (conn);
 		sftp_connection_unlock (conn);
 
 		*method_handle = NULL;
 		DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", __FUNCTION__));
-		return sftp_status_to_vfs_result (sftp_res);
+		return sftp_res;
 	}
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]