client: fix boinc_copy (again); Mac Mgr: fix bugs showing Mgr when minimized to Dock; fix XCode project for moved src file.

svn path=/trunk/boinc/; revision=16929
This commit is contained in:
Charlie Fenton 2009-01-16 06:41:52 +00:00
parent 9a2868e715
commit be2b680f1d
6 changed files with 74 additions and 5 deletions

View File

@ -451,3 +451,23 @@ Eric 15 Jan 2009
example_app/
Makefile
Charlie Jan 15 2009
- client: boinc_copy ownership fix of 1/6/09 didn't work because it used
system(cp ...) call, which invokes a shell, and POSIX specifies that
shells run from an application use the real UID and GID not the
effective UID and GID. Changed boinc_copy to copy file directly.
- MGR: On Mac, fix problems showing Manager window when it was minimized
to Dock, especially if window was closed using Dock menu.
- Mac: Fix XCode project for boinc_cmd.cpp moved to client/ from lib/.
client/
app_start.cpp
clientgui/
BOINCBaseFrame.cpp
BOINCGUIApp.h
BOINCTaskBar.cpp
lib/
filesys.cpp
mac_build/
boinc.xcodeproj/
project.pbxproj

View File

@ -283,6 +283,9 @@ static int setup_file(
);
return retval;
}
#ifdef SANDBOX
return set_to_project_group(link_path);
#endif
}
return 0;
}

View File

@ -305,7 +305,11 @@ void CBOINCBaseFrame::OnClose(wxCloseEvent& event) {
wxLogTrace(wxT("Function Start/End"), wxT("CBOINCBaseFrame::OnClose - Function Begin"));
#if defined(__WXMSW__) || defined(__WXMAC__)
if (!event.CanVeto()) {
if (!event.CanVeto()
#ifdef __WXMAC__
|| IsIconized()
#endif
) {
wxGetApp().FrameClosed();
Destroy();
} else {

View File

@ -159,6 +159,8 @@ public:
bool SetActiveGUI(int iGUISelection, bool bShowWindow = true);
bool ShowCurrentGUI() { return SetActiveGUI(m_iGUISelected, true); }
void OnRPCFinished( CRPCFinishedEvent& event );
int ConfirmExit();

View File

@ -169,7 +169,11 @@ void CTaskBarIcon::OnOpen(wxCommandEvent& WXUNUSED(event)) {
if (pFrame) {
pFrame->Show();
#ifndef __WXMAC__
#ifdef __WXMAC__
if (pFrame->IsIconized()) {
pFrame->Iconize(false);
}
#else
if (pFrame->IsMaximized()) {
pFrame->Maximize(true);
} else {
@ -183,6 +187,11 @@ void CTaskBarIcon::OnOpen(wxCommandEvent& WXUNUSED(event)) {
::SetForegroundWindow((HWND)pFrame->GetHandle());
#endif
}
#ifdef __WXMAC__
else {
wxGetApp().ShowCurrentGUI();
}
#endif
}

View File

@ -504,9 +504,40 @@ int boinc_copy(const char* orig, const char* newf) {
sprintf(cmd, "copy \"%s\" \"%s\"", orig, newf);
return system(cmd);
#else
char cmd[1024];
sprintf(cmd, "cp -p \"%s\" \"%s\"", orig, newf);
return system(cmd);
// POSIX requires that shells run from an application will use the
// real UID and GID if different from the effective UID and GID.
// Mac OS 10.4 did not enforce this, but OS 10.5 does. Since
// system() invokes a shell, it may not properly copy the file's
// ownership or permissions when called from the BOINC Client
// under sandbox security, so we copy the file directly.
FILE *src, *dst;
int m, n;
int retval = 0;
struct stat sbuf;
unsigned char buf[65536];
src = boinc_fopen(orig, "r");
if (!src) return ERR_FOPEN;
dst = boinc_fopen(newf, "w");
if (!dst) {
fclose(src);
return ERR_FOPEN;
}
while (1) {
n = fread(buf, 1, sizeof(buf), src);
if (n <= 0) break;
m = fwrite(buf, 1, n, dst);
if (m != n) {
retval = ERR_FWRITE;
break;
}
}
fclose(src);
fclose(dst);
// Copy file's ownership, permissions to the extent we are allowed
lstat(orig, &sbuf); // Get source file's info
chown(newf, sbuf.st_uid, sbuf.st_gid);
chmod(newf, sbuf.st_mode);
return retval;
#endif
}