From 2b31d917739ad89ee3b66cf09b34fbe175ab89b4 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 5 Oct 2005 20:39:00 +0000 Subject: [PATCH] fflush before _exit() svn path=/trunk/boinc/; revision=8516 --- api/boinc_api.C | 2 +- checkin_notes | 12 ++++++++++++ client/app_start.C | 2 ++ client/cs_benchmark.C | 6 ++++-- clientgui/mac/mac_saver_module.cpp | 2 ++ 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/api/boinc_api.C b/api/boinc_api.C index c7a3d9743d..2eb516043e 100644 --- a/api/boinc_api.C +++ b/api/boinc_api.C @@ -385,7 +385,7 @@ void boinc_exit(int status) { // This is not pretty but unless someone finds a cleaner solution, // we handle the Mac-case separately . #ifdef __APPLE_CC__ - fflush(stderr); + fflush(NULL); _exit(status); #else exit(status); diff --git a/checkin_notes b/checkin_notes index 9b85ab9025..ddf1d7ec8b 100755 --- a/checkin_notes +++ b/checkin_notes @@ -12773,3 +12773,15 @@ David 5 Oct 2005 Rom 5 Oct 2005 (staging) - Tag for 5.1.7 release, all platforms boinc_core_release_5_1_7 + +David 5 Oct 2005 + - before any _exit() (API, app start, etc.) do a fflush(NULL) + (from Bruce Allen) + + api/ + boinc_api.C + client/ + app_start.C + cs_benchmark.C + clientgui/mac/ + mac_saver_module.cpp diff --git a/client/app_start.C b/client/app_start.C index fd2338d736..87473c70ba 100644 --- a/client/app_start.C +++ b/client/app_start.C @@ -442,6 +442,7 @@ int ACTIVE_TASK::start(bool first_time) { retval = chdir(slot_dir); if (retval) { perror("chdir"); + fflush(NULL); _exit(retval); } @@ -460,6 +461,7 @@ int ACTIVE_TASK::start(bool first_time) { "execv(%s) failed: %s\n", buf, boincerror(retval) ); perror("execv"); + fflush(NULL); _exit(errno); } diff --git a/client/cs_benchmark.C b/client/cs_benchmark.C index 0c2739e047..3e3493b743 100644 --- a/client/cs_benchmark.C +++ b/client/cs_benchmark.C @@ -168,7 +168,7 @@ DWORD WINAPI win_cpu_benchmarks(LPVOID p) { #endif void CLIENT_STATE::start_cpu_benchmarks() { - int i; + int i, retval; SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_MEASUREMENT); @@ -208,7 +208,9 @@ void CLIENT_STATE::start_cpu_benchmarks() { sprintf(benchmark_descs[i].filename, "%s_%d.xml", CPU_BENCHMARKS_FILE_NAME, i); PROCESS_ID pid = fork(); if (pid == 0) { - _exit(cpu_benchmarks(benchmark_descs+i)); + retval = cpu_benchmarks(benchmark_descs+i); + fflush(NULL); + _exit(retval); } else { benchmark_descs[i].pid = pid; } diff --git a/clientgui/mac/mac_saver_module.cpp b/clientgui/mac/mac_saver_module.cpp index 97db13f383..0f37ac2d52 100755 --- a/clientgui/mac/mac_saver_module.cpp +++ b/clientgui/mac/mac_saver_module.cpp @@ -208,10 +208,12 @@ OSStatus initBOINCApp() { status = chdir(buf); if (status) { perror("chdir"); + fflush(NULL); _exit(status); } status = execl(boincPath, "boinc", "-redirectio", (char *) 0); + fflush(NULL); _exit(127); // execl error (execl should never return) } else { CoreClientPID = myPid; // make this available globally