From 73ee4526e3375605102a9a611fe8c1544aa1cb05 Mon Sep 17 00:00:00 2001 From: Tunnelblick developer Date: Mon, 19 Jan 2026 15:22:33 -0500 Subject: [PATCH] Fix failure to install 3.5.26 Installing Tunnelblick 3.5.26 on a computer that has not had another version of Tunnelblick fails because the folder /Library/Application Support/Tunnelblick is being created after it is being used. This fixes that by moving creation of the folder to immediately before it is first used. --- tunnelblick/installer.m | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tunnelblick/installer.m b/tunnelblick/installer.m index d55fe56b5..35f8323b2 100644 --- a/tunnelblick/installer.m +++ b/tunnelblick/installer.m @@ -132,9 +132,9 @@ void debugLog(NSString * string) { } void openLog(BOOL clearLog) { - + const char * path = [INSTALLER_LOG_PATH fileSystemRepresentation]; - + if ( clearLog ) { gLogFile = fopen(path, "w"); } else { @@ -550,8 +550,15 @@ int main(int argc, char *argv[]) BOOL forceLoadLaunchDaemon = copyApp || secureApp; - openLog( clearLog ); - + // Create the folder which contains the log + gFileMgr = [NSFileManager defaultManager]; + if ( ! createDirWithPermissionAndOwnership(@"/Library/Application Support/Tunnelblick", + PERMS_SECURED_FOLDER, 0, 0) ) { + errorExit(); + } + + openLog( clearLog ); + NSBundle * ourBundle = [NSBundle mainBundle]; NSString * resourcesPath = [ourBundle bundlePath]; // (installer itself is in Resources) NSArray * execComponents = [resourcesPath pathComponents]; @@ -583,8 +590,7 @@ int main(int argc, char *argv[]) appendLog([NSString stringWithFormat: @"Tunnelblick installer started %@. %d arguments:%@", dateMsg, argc - 1, argString]); - gFileMgr = [NSFileManager defaultManager]; - gPrivatePath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/Tunnelblick/Configurations/"] copy]; + gPrivatePath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Library/Application Support/Tunnelblick/Configurations/"] copy]; // If we copy the .app to /Applications, other changes to the .app affect THAT copy, otherwise they affect the currently running copy NSString * appResourcesPath = (copyApp @@ -617,14 +623,9 @@ int main(int argc, char *argv[]) } //************************************************************************************************************************** - // (1) Create directories or repair their ownership/permissions as needed + // (1) Create other directories or repair their ownership/permissions as needed // and convert old entries in L_AS_T_TBLKS to the new format, with an bundleId_edition folder enclosing a .tblk - if ( ! createDirWithPermissionAndOwnership(@"/Library/Application Support/Tunnelblick", - PERMS_SECURED_FOLDER, 0, 0) ) { - errorExit(); - } - if ( ! createDirWithPermissionAndOwnership(L_AS_T_LOGS, PERMS_SECURED_FOLDER, 0, 0) ) { errorExit();