[gvfs/gnome-3-20] afc: Indicate whether to retry to setup HouseArrest for an app



commit 1655b3dbb6fb94e54af25ca4cb4c74a8859d9893
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Mar 23 19:01:44 2016 +0100

    afc: Indicate whether to retry to setup HouseArrest for an app
    
    If setting up the HouseArrest service for an app fails, we should clean
    up unused services, and try again. This tells us whether we should try
    again in the first place.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676188

 daemon/gvfsbackendafc.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index 6bc9877..45ce968 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -761,7 +761,7 @@ is_regular (GVfsBackendAfc *backend,
   return result;
 }
 
-static void
+static gboolean
 g_vfs_backend_setup_afc_for_app (GVfsBackendAfc *self,
                                  const char     *id)
 {
@@ -772,6 +772,7 @@ g_vfs_backend_setup_afc_for_app (GVfsBackendAfc *self,
   afc_client_t afc;
   plist_t dict, error;
   lockdownd_error_t lerr;
+  gboolean retry = FALSE;
 
   g_mutex_lock (&self->apps_lock);
 
@@ -792,6 +793,8 @@ g_vfs_backend_setup_afc_for_app (GVfsBackendAfc *self,
   lerr = lockdownd_start_service (lockdown_cli, "com.apple.mobile.house_arrest", &lockdown_service);
   if (lerr != LOCKDOWN_E_SUCCESS)
     {
+      if (lerr == LOCKDOWN_E_SERVICE_LIMIT)
+        retry = TRUE;
       lockdownd_client_free (lockdown_cli);
       g_warning ("Failed to start house arrest for app %s (%d)", info->id, lerr);
       goto out;
@@ -850,6 +853,7 @@ g_vfs_backend_setup_afc_for_app (GVfsBackendAfc *self,
 
 out:
   g_mutex_unlock (&self->apps_lock);
+  return !retry;
 }
 
 /* If force_afc_mount is TRUE, then we'll try to mount


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