diff --git a/checkin_notes b/checkin_notes index e4f2032985..60310ad239 100644 --- a/checkin_notes +++ b/checkin_notes @@ -487,3 +487,11 @@ David 18 Jan 2010 sched/ sched_types.cpp +David 18 Jan 2010 + - API: fix crashing bug. Don't memset(0) APP_INIT_DATA; + it contains HOST_INFO, which now contains COPROCS, + which has a vector. + Define a clear() for APP_INIT_DATA. + + lib/ + app_ipc.cpp,h diff --git a/lib/app_ipc.cpp b/lib/app_ipc.cpp index 5efd033fb9..abcc769c3e 100644 --- a/lib/app_ipc.cpp +++ b/lib/app_ipc.cpp @@ -217,6 +217,44 @@ int write_init_data_file(FILE* f, APP_INIT_DATA& ai) { return 0; } +void APP_INIT_DATA::clear() { + major_version = 0; + minor_version = 0; + release = 0; + app_version = 0; + strcpy(app_name, ""); + strcpy(symstore, ""); + strcpy(acct_mgr_url, ""); + project_preferences = NULL; + hostid = 0; + strcpy(user_name, ""); + strcpy(team_name, ""); + strcpy(project_dir, ""); + strcpy(boinc_dir, ""); + strcpy(wu_name, ""); + strcpy(authenticator, ""); + slot = 0; + user_total_credit = 0; + user_expavg_credit = 0; + host_total_credit = 0; + host_expavg_credit = 0; + resource_share_fraction = 0; + host_info.clear_host_info(); + proxy_info.clear(); + global_prefs.defaults(); + starting_elapsed_time = 0; + rsc_fpops_est = 0; + rsc_fpops_bound = 0; + rsc_memory_bound = 0; + rsc_disk_bound = 0; + computation_deadline = 0; + fraction_done_start = 0; + fraction_done_end = 0; + double checkpoint_period = 0; + memset(&shmem_seg_name, 0, sizeof(shmem_seg_name)); + double wu_cpu_time = 0; +} + int parse_init_data_file(FILE* f, APP_INIT_DATA& ai) { char tag[1024]; int retval; @@ -235,7 +273,7 @@ int parse_init_data_file(FILE* f, APP_INIT_DATA& ai) { free(ai.project_preferences); ai.project_preferences = 0; } - memset(&ai, 0, sizeof(ai)); + ai.clear(); ai.fraction_done_start = 0; ai.fraction_done_end = 1; diff --git a/lib/app_ipc.h b/lib/app_ipc.h index fd547e7a84..7f5037179e 100644 --- a/lib/app_ipc.h +++ b/lib/app_ipc.h @@ -195,6 +195,7 @@ struct APP_INIT_DATA { APP_INIT_DATA(const APP_INIT_DATA&); // copy constructor APP_INIT_DATA &operator=(const APP_INIT_DATA&); void copy(const APP_INIT_DATA&); // actually do the copy here + void clear(); ~APP_INIT_DATA(); };