From a4bd5443f381478a9b8e86a1422e281ab3e5b920 Mon Sep 17 00:00:00 2001 From: Zorg Date: Wed, 11 Nov 2015 23:08:41 -0500 Subject: [PATCH] Handle additional permission denied code when copying files afpAccessDenied can be returned even when not using a AFP mount, at least according to my testing. Having an installation do a copy (because of different mounts) and auth may not be a likely scenario, so this may not be hit often. --- Sparkle/SUFileManager.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sparkle/SUFileManager.m b/Sparkle/SUFileManager.m index bb989240..2f687f72 100644 --- a/Sparkle/SUFileManager.m +++ b/Sparkle/SUFileManager.m @@ -386,7 +386,9 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza return YES; } - if (copyResult != permErr) { + // Note: I have recieved afpAccessDenied error in testing even when not copying from/to an AFP mount, + // when the error should have been a normal permission denied one + if (copyResult != permErr && copyResult != afpAccessDenied) { if (error != NULL) { *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:copyResult userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to copy file (%@)", sourceURL.lastPathComponent] }]; }