V6 GFX: Fix bug on OS 10.3.9

svn path=/trunk/boinc/; revision=13532
This commit is contained in:
Charlie Fenton 2007-09-04 07:40:18 +00:00
parent dabba949a4
commit d269036df3
2 changed files with 16 additions and 6 deletions

View File

@ -22,6 +22,8 @@ static int clicked_button;
static int win=0;
#ifdef __APPLE__
#include <sys/param.h> // for MAXPATHLEN
static bool need_show = false;
#endif
@ -138,6 +140,10 @@ static void timer_handler(int) {
}
void boinc_graphics_loop(int argc, char** argv) {
#ifdef __APPLE__
char dir [MAXPATHLEN];
getcwd(dir, MAXPATHLEN);
#endif
for (int i=1; i<argc; i++) {
if (!strcmp(argv[i], "--fullscreen")) {
fullscreen = true;
@ -146,5 +152,9 @@ void boinc_graphics_loop(int argc, char** argv) {
boinc_glut_init();
make_window();
glutTimerFunc(TIMER_INTERVAL_MSEC, timer_handler, 0);
#ifdef __APPLE__
// Apparently glut changed our working directory in OS 10.3.9
chdir(dir);
#endif
glutMainLoop();
}

View File

@ -42,6 +42,9 @@ void* boinc_graphics_make_shmem(char* prog_name, int size) {
char shmem_name[256];
get_shmem_name(prog_name, shmem_name);
int retval = create_shmem(shmem_name, size, &p);
// Graphics app may be run by a different user & group than worker app
// Although create_shmem passed 0666 to open(), it was modified by umask
if (retval == 0) chmod(shmem_name, 0666);
#else
key_t key = get_shmem_name(prog_name);
int retval = create_shmem(key, size, 0, &p);
@ -64,17 +67,14 @@ void* boinc_graphics_get_shmem(char* prog_name) {
#else
void* boinc_graphics_get_shmem(char* prog_name) {
void* p;
int retval;
#ifdef USE_FILE_MAPPED_SHMEM
struct stat sbuf;
char shmem_name[256];
get_shmem_name(prog_name, shmem_name);
int retval = stat(shmem_name, &sbuf);
if (retval == 0) {
retval = create_shmem(shmem_name, sbuf.st_size, &p);
}
retval = attach_shmem(shmem_name, &p);
#else
key_t key = get_shmem_name(prog_name);
int retval = attach_shmem(key, &p);
retval = attach_shmem(key, &p);
#endif
if (retval) return 0;
return p;