mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-26 04:57:54 +00:00
Don't log SMJobRemove() job not found error
Also rationalize why we aren't first checking if the job already exists
This commit is contained in:
1 parent
2c3996a522
commit
64d740a761
1 file changed
+7
-1
@@ -45,10 +45,16 @@
|
||||
CFStringRef domain = (grantsSystemPrivilege ? kSMDomainSystemLaunchd : kSMDomainUserLaunchd);
|
||||
NSString *label = [NSString stringWithFormat:@"%@-sparkle-updater", hostBundleIdentifier];
|
||||
|
||||
// Try to remove the job from launchd if it is already running
|
||||
// We could invoke SMJobCopyDictionary() first to see if the job exists, but I'd rather avoid
|
||||
// using it because the headers indicate it may be removed one day without any replacement
|
||||
CFErrorRef removeError = NULL;
|
||||
if (!SMJobRemove(domain, (__bridge CFStringRef)(label), auth, true, &removeError)) {
|
||||
if (removeError != NULL) {
|
||||
SULog(@"Remove error: %@", removeError);
|
||||
// It's normal for a job to not be found, so this is not an interesting error
|
||||
if (CFErrorGetCode(removeError) != kSMErrorJobNotFound) {
|
||||
SULog(@"Remove error: %@", removeError);
|
||||
}
|
||||
CFRelease(removeError);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user