[gvfs/ftp-reorg] [FTP] handle error cases when opening/closing data connection
- From: Benjamin Otte <otte src gnome org>
- To: svn-commits-list gnome org
- Subject: [gvfs/ftp-reorg] [FTP] handle error cases when opening/closing data connection
- Date: Fri, 5 Jun 2009 12:55:20 -0400 (EDT)
commit 6def1a764dd271d714dcab2d38389c9329ab0894
Author: Benjamin Otte <otte gnome org>
Date: Fri Jun 5 13:51:43 2009 +0200
[FTP] handle error cases when opening/closing data connection
There were a few conditions that were checked using return_if_fail()
that were valid.
---
daemon/gvfsftptask.c | 14 +++++++++++---
daemon/gvfsftptask.h | 5 +----
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/daemon/gvfsftptask.c b/daemon/gvfsftptask.c
index 4c89d14..7ef998b 100644
--- a/daemon/gvfsftptask.c
+++ b/daemon/gvfsftptask.c
@@ -869,6 +869,17 @@ g_vfs_ftp_task_open_data_connection_pasv (GVfsFtpTask *task)
*
* Closes any data connection @task might have opened.
*/
+void
+g_vfs_ftp_task_close_data_connection (GVfsFtpTask *task)
+{
+ g_return_if_fail (task != NULL);
+
+ if (task->conn == NULL)
+ return;
+
+ g_vfs_ftp_connection_close_data_connection (task->conn);
+}
+
/**
* g_vfs_ftp_task_open_data_connection:
* @task: a task not having an open data connection
@@ -884,9 +895,6 @@ g_vfs_ftp_task_open_data_connection (GVfsFtpTask *task)
if (g_vfs_ftp_task_is_in_error (task))
return;
- /* only check this here, erroneous connection might have failed to acquire a connection. */
- g_return_if_fail (task->conn != NULL);
-
if (g_vfs_ftp_task_open_data_connection_epsv (task))
return;
diff --git a/daemon/gvfsftptask.h b/daemon/gvfsftptask.h
index d9bfce3..6453f41 100644
--- a/daemon/gvfsftptask.h
+++ b/daemon/gvfsftptask.h
@@ -83,10 +83,7 @@ guint g_vfs_ftp_task_receive (GVfsFtpTask *
GVfsFtpResponseFlags flags,
char *** reply);
void g_vfs_ftp_task_open_data_connection (GVfsFtpTask * task);
-#define g_vfs_ftp_task_close_data_connection(task) G_STMT_START{\
- if ((task)->conn) \
- g_vfs_ftp_connection_close_data_connection((task)->conn);\
-}G_STMT_END
+void g_vfs_ftp_task_close_data_connection (GVfsFtpTask * task);
gboolean g_vfs_ftp_task_login (GVfsFtpTask * task,
const char * username,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]