summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2016-03-23 19:01:44 +0100
committerBastien Nocera <hadess@hadess.net>2016-06-09 12:49:49 +0200
commit1655b3dbb6fb94e54af25ca4cb4c74a8859d9893 (patch)
tree6fbef9dc04c3b2f1fdc152a1e3e71e8b8a93ef84
parente9058860b2cbb01fa8f613f4c102af96317c1701 (diff)
downloadgvfs-1655b3dbb6fb94e54af25ca4cb4c74a8859d9893.tar.gz
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
-rw-r--r--daemon/gvfsbackendafc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/daemon/gvfsbackendafc.c b/daemon/gvfsbackendafc.c
index 6bc98774..45ce9687 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