From 5504d6896f82a38956ec8b6f404cc81f01df76ef Mon Sep 17 00:00:00 2001 From: Jorge Leandro Perez Date: Tue, 28 Jan 2014 01:23:06 -0300 Subject: [PATCH] Fixes static analyzer warnings --- SUAppcast.m | 5 ++++- SUBinaryDeltaCommon.m | 2 +- SUPlainInstallerInternals.m | 9 +++++++-- finish_installation.m | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/SUAppcast.m b/SUAppcast.m index 04af5a19..994edf42 100644 --- a/SUAppcast.m +++ b/SUAppcast.m @@ -194,7 +194,10 @@ else if (name != nil) { // add all other values as strings - [dict setObject:[[node stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] forKey:name]; + NSString *theValue = [[node stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; + if (theValue != nil) { + [dict setObject:theValue forKey:name]; + } } } diff --git a/SUBinaryDeltaCommon.m b/SUBinaryDeltaCommon.m index 4315d95d..d0241234 100644 --- a/SUBinaryDeltaCommon.m +++ b/SUBinaryDeltaCommon.m @@ -44,7 +44,7 @@ NSString *temporaryFilename(NSString *base) NSString *template = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.XXXXXXXXXX", base]]; char buffer[MAXPATHLEN]; strcpy(buffer, [template fileSystemRepresentation]); - return [NSString stringWithUTF8String:mktemp(buffer)]; + return [NSString stringWithUTF8String:mkstemp(buffer)]; } static void _hashOfBuffer(unsigned char *hash, const char* buffer, size_t bufferLength) diff --git a/SUPlainInstallerInternals.m b/SUPlainInstallerInternals.m index 7cebc993..d9a5e50a 100644 --- a/SUPlainInstallerInternals.m +++ b/SUPlainInstallerInternals.m @@ -198,8 +198,13 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza // quarantine to avoid a delay at launch, and to avoid // presenting the user with a confusing trust dialog. // - // This needs to be done before "chown" changes ownership, - // because the ownership change will fail if the file is quarantined. + // This needs to be done after the application is moved to its + // new home with "mv" in case it's moved across filesystems: if + // that happens, "mv" actually performs a copy and may result + // in the application being quarantined. It also needs to be + // done before "chown" changes ownership, because the ownership + // change will almost certainly make it impossible to change + // attributes to release the files from the quarantine. if (res) { SULog(@"releaseFromQuarantine"); diff --git a/finish_installation.m b/finish_installation.m index 740de4b4..dc07c16e 100644 --- a/finish_installation.m +++ b/finish_installation.m @@ -151,6 +151,7 @@ [statusCtl beginActionWithTitle: SULocalizedString(@"Installing update...",@"") maxProgressValue: 0 statusText: @""]; [statusCtl showWindow: self]; + [statusCtl release]; } [SUInstaller installFromUpdateFolder: [[NSFileManager defaultManager] stringWithFileSystemRepresentation: folderpath length: strlen(folderpath)]