From dbbd2a3ff9fc2cf93b1eb59cd1fd46692f5f24a3 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Fri, 21 Oct 2011 16:34:45 +0000 Subject: [PATCH] - VBOX: Don't redirect VirtualBox to a different directory structure for the root configuration file when the client is NOT in sandbox mode. Doing so could cause confusion if the volunteer uses VirtualBox for any of their own work. If BOINC started up first it would have appeared that their own VM's no longer existed. samples/vboxwrapper/ vbox.cpp svn path=/trunk/boinc/; revision=24449 --- checkin_notes | 10 ++++++++++ samples/vboxwrapper/vbox.cpp | 38 +++++++++++++++++++----------------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/checkin_notes b/checkin_notes index eb92e2ad40..354c638533 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7608,3 +7608,13 @@ Charlie 21 Oct 2011 sg_BoincSimpleFrame.cpp,.h sg_DlgMessages.cpp,.h sg_DlgPreferences.cpp,.h + +Rom 21 Oct 2011 + - VBOX: Don't redirect VirtualBox to a different directory structure for + the root configuration file when the client is NOT in sandbox mode. + Doing so could cause confusion if the volunteer uses VirtualBox for + any of their own work. If BOINC started up first it would have appeared + that their own VM's no longer existed. + + samples/vboxwrapper/ + vbox.cpp diff --git a/samples/vboxwrapper/vbox.cpp b/samples/vboxwrapper/vbox.cpp index 76905524cb..063aca7cc2 100644 --- a/samples/vboxwrapper/vbox.cpp +++ b/samples/vboxwrapper/vbox.cpp @@ -416,29 +416,31 @@ int VBOX_VM::initialize() { // Set the location in which the VirtualBox Configuration files can be // stored for this instance. // - virtualbox_user_home = aid.project_dir; - virtualbox_user_home += "/../virtualbox"; + if (aid.using_sandbox) { + virtualbox_user_home = aid.project_dir; + virtualbox_user_home += "/../virtualbox"; - if (!boinc_file_exists(virtualbox_user_home.c_str())) boinc_mkdir(virtualbox_user_home.c_str()); + if (!boinc_file_exists(virtualbox_user_home.c_str())) boinc_mkdir(virtualbox_user_home.c_str()); #ifdef _WIN32 - if (!SetEnvironmentVariable("VBOX_USER_HOME", const_cast(virtualbox_user_home.c_str()))) { - fprintf( - stderr, - "%s Failed to modify the search path.\n", - boinc_msg_prefix(buf, sizeof(buf)) - ); - } + if (!SetEnvironmentVariable("VBOX_USER_HOME", const_cast(virtualbox_user_home.c_str()))) { + fprintf( + stderr, + "%s Failed to modify the search path.\n", + boinc_msg_prefix(buf, sizeof(buf)) + ); + } #else - // putenv does not copy its input buffer, so we must use setenv - if (setenv("VBOX_USER_HOME", const_cast(virtualbox_user_home.c_str()), 1)) { - fprintf( - stderr, - "%s Failed to modify the VBOX_USER_HOME path.\n", - boinc_msg_prefix(buf, sizeof(buf)) - ); - } + // putenv does not copy its input buffer, so we must use setenv + if (setenv("VBOX_USER_HOME", const_cast(virtualbox_user_home.c_str()), 1)) { + fprintf( + stderr, + "%s Failed to modify the VBOX_USER_HOME path.\n", + boinc_msg_prefix(buf, sizeof(buf)) + ); + } #endif + } return 0; }