[gvfs] ftp: Prevent segfault when unmounting



commit d603ba4983d249349e7384f31fd2ed921e65e869
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Sun Mar 1 16:47:45 2015 +0000

    ftp: Prevent segfault when unmounting
    
    If a job is waiting for a connection in
    g_vfs_ftp_task_acquire_connection and the backend is force unmounted,
    the queue is freed, and the function neither gets a connection nor
    sets an error message which causes an issue later.
    
    To fix this, set an error message if the queue is freed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=653042

 daemon/gvfsftptask.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gvfsftptask.c b/daemon/gvfsftptask.c
index d78e0d5..c70262b 100644
--- a/daemon/gvfsftptask.c
+++ b/daemon/gvfsftptask.c
@@ -269,7 +269,11 @@ g_vfs_ftp_task_acquire_connection (GVfsFtpTask *task)
           break;
         }
     }
+  if (!ftp->queue)
+    task->error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_NOT_MOUNTED,
+                                       _("Backend currently unmounting"));
   g_mutex_unlock (&ftp->mutex);
+
 out_unlocked:
   g_cancellable_disconnect (task->cancellable, id);
 


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