[gvfs] afc: Indicate whether to retry to setup HouseArrest for an app



commit 04203326a76e6eaa20971004e3f276025113b0e9
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 d7048f0..84f1a54 100644
--- a/daemon/gvfsbackendafc.c
+++ b/daemon/gvfsbackendafc.c
@@ -765,7 +765,7 @@ is_regular (GVfsBackendAfc *backend,
   return result;
 }
 
-static void
+static gboolean
 g_vfs_backend_setup_afc_for_app (GVfsBackendAfc *self,
                                  const char     *id)
 {
@@ -776,6 +776,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);
 
@@ -796,6 +797,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;
@@ -854,6 +857,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]