From b50cc81a9336776e62ca511f52cb86a7d81ee13d Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Tue, 1 Sep 2009 03:51:03 +0000 Subject: [PATCH] Mac installer: add logic for setting BOINC as screensaver under OS 10.6 svn path=/trunk/boinc/; revision=18964 --- mac_installer/PostInstall.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/mac_installer/PostInstall.cpp b/mac_installer/PostInstall.cpp index 39b2579021..06ab255987 100755 --- a/mac_installer/PostInstall.cpp +++ b/mac_installer/PostInstall.cpp @@ -659,6 +659,7 @@ OSErr UpdateAllVisibleUsers(long brandID) char s[256]; group *grp; Boolean saverAlreadySet = true; + Boolean found = false; FILE *f; OSStatus err; long response; @@ -722,14 +723,23 @@ OSErr UpdateAllVisibleUsers(long brandID) if (response < 0x1060) { f = popen("defaults -currentHost read com.apple.screensaver moduleName", "r"); } else { - f = popen("defaults -currentHost read com.apple.screensaver moduleDict -dict", "r"); + sprintf(s, "sudo -u %s defaults -currentHost read com.apple.screensaver moduleDict -dict", + dp->d_name); + f = popen(s, "r"); } if (f) { - PersistentFGets(s, sizeof(s), f); - if (!strstr(s, saverName[brandID])) - saverAlreadySet = false; + found = false; + while (PersistentFGets(s, sizeof(s), f)) { + if (strstr(s, saverName[brandID])) { + found = true; + break; + } + } pclose(f); + if (!found) { + saverAlreadySet = false; + } } seteuid(saved_uid); // Set effective uid back to privileged user