From 480f497e03d20625bb970e8392d617b1d13c5be1 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 6 Mar 2008 16:15:17 +0000 Subject: [PATCH] - wrapper: if a child exits with nonzero status X, call boinc_finish() with ERR_CHILD_FAILED rather than X. If X is zero in the low-order byte (e.g. if the program isn't executable) the BOINC client will restart us, which isn't what we want. svn path=/trunk/boinc_samples/; revision=14858 --- checkin_notes | 10 ++++++++++ wrapper/wrapper.C | 10 ++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/checkin_notes b/checkin_notes index 58707a13a3..24c0a23438 100644 --- a/checkin_notes +++ b/checkin_notes @@ -543,3 +543,13 @@ Charlie 21 Feb 2008 mac/ uc2_graphics.icns app_icon.h + +David 6 Mar 2008 + - wrapper: if a child exits with nonzero status X, + call boinc_finish() with ERR_CHILD_FAILED rather than X. + If X is zero in the low-order byte + (e.g. if the program isn't executable) + the BOINC client will restart us, which isn't what we want. + + wrapper/ + wrapper.C diff --git a/wrapper/wrapper.C b/wrapper/wrapper.C index 0e9c2996d3..c7c61879a0 100644 --- a/wrapper/wrapper.C +++ b/wrapper/wrapper.C @@ -490,8 +490,14 @@ int main(int argc, char** argv) { int status; if (task.poll(status)) { if (status) { - fprintf(stderr, "app error: 0x%x\n", status); - boinc_finish(status); + fprintf(stderr, "app exit status: 0x%x\n", status); + // On Unix, if the app is non-executable, + // the child status will be 0x6c00. + // If we return this the client will treat it + // as recoverable, and restart us. + // We don't want this, so return an 8-bit error code. + // + boinc_finish(ERR_CHILD_FAILED); } break; }