mirror of https://github.com/BOINC/boinc.git
- client: check return value of the function (statfs or statvfs)
used to find disk space and usage. This may be failing for in-memory filesystems on Linux.
This commit is contained in:
parent
d4a40a8841
commit
3a530a4c34
|
@ -137,7 +137,15 @@ static void handle_get_disk_usage(GUI_RPC_CONN& grc) {
|
|||
double size, boinc_non_project, d_allowed, boinc_total;
|
||||
|
||||
grc.mfout.printf("<disk_usage_summary>\n");
|
||||
get_filesystem_info(gstate.host_info.d_total, gstate.host_info.d_free);
|
||||
int retval = get_filesystem_info(
|
||||
gstate.host_info.d_total, gstate.host_info.d_free
|
||||
);
|
||||
if (retval) {
|
||||
msg_printf(0, MSG_INTERNAL_ERROR,
|
||||
"get_filesystem_info(): %s", boincerror(retval)
|
||||
);
|
||||
}
|
||||
|
||||
dir_size(".", boinc_non_project, false);
|
||||
dir_size("locale", size, false);
|
||||
boinc_non_project += size;
|
||||
|
|
|
@ -1271,7 +1271,12 @@ int HOST_INFO::get_virtualbox_version() {
|
|||
// - only one level of #if
|
||||
//
|
||||
int HOST_INFO::get_host_info() {
|
||||
get_filesystem_info(d_total, d_free);
|
||||
int retval = get_filesystem_info(d_total, d_free);
|
||||
if (retval) {
|
||||
msg_printf(0, MSG_INTERNAL_ERROR,
|
||||
"get_filesystem_info() failed: %s", boincerror(retval)
|
||||
);
|
||||
}
|
||||
get_virtualbox_version();
|
||||
|
||||
///////////// p_vendor, p_model, p_features /////////////////
|
||||
|
|
|
@ -1253,7 +1253,12 @@ int HOST_INFO::get_virtualbox_version() {
|
|||
//
|
||||
int HOST_INFO::get_host_info() {
|
||||
get_timezone(timezone);
|
||||
get_filesystem_info(d_total, d_free);
|
||||
int retval = get_filesystem_info(d_total, d_free);
|
||||
if (retval) {
|
||||
msg_printf(0, MSG_INTERNAL_ERROR,
|
||||
"get_filesystem_info(): %s", boincerror(retval)
|
||||
);
|
||||
}
|
||||
get_memory_info(m_nbytes, m_swap);
|
||||
get_os_information(
|
||||
os_name, sizeof(os_name), os_version, sizeof(os_version)
|
||||
|
|
|
@ -199,6 +199,7 @@
|
|||
#define ERR_CRYPTO -231
|
||||
#define ERR_ABORTED_ON_EXIT -232
|
||||
#define ERR_PROC_PARSE -235
|
||||
#define ERR_STATFS -236
|
||||
|
||||
// PLEASE: add a text description of your error to
|
||||
// the text description function boincerror() in str_util.cpp.
|
||||
|
|
|
@ -765,8 +765,6 @@ void relative_to_absolute(const char* relname, char* path) {
|
|||
}
|
||||
}
|
||||
|
||||
// get total and free space on current filesystem (in bytes)
|
||||
//
|
||||
#if defined(_WIN32) && !(defined(WXDEBUG) || defined(WXNDEBUG))
|
||||
int boinc_allocate_file(const char* path, double size) {
|
||||
int retval = 0;
|
||||
|
@ -794,6 +792,8 @@ int boinc_allocate_file(const char* path, double size) {
|
|||
}
|
||||
#endif
|
||||
|
||||
// get total and free dpace on current filesystem (in bytes)
|
||||
//
|
||||
#ifdef _WIN32
|
||||
int get_filesystem_info(double &total_space, double &free_space, char*) {
|
||||
char cwd[MAXPATHLEN];
|
||||
|
@ -832,7 +832,11 @@ int get_filesystem_info(double &total_space, double &free_space, char* path) {
|
|||
#ifdef STATFS
|
||||
struct STATFS fs_info;
|
||||
|
||||
STATFS(path, &fs_info);
|
||||
int retval = STATFS(path, &fs_info);
|
||||
if (retval) {
|
||||
perror("statvfs");
|
||||
return ERR_STATFS;
|
||||
}
|
||||
#if HAVE_SYS_STATVFS_H
|
||||
total_space = (double)fs_info.f_frsize * (double)fs_info.f_blocks;
|
||||
free_space = (double)fs_info.f_frsize * (double)fs_info.f_bavail;
|
||||
|
|
|
@ -111,9 +111,9 @@ int process_input_files(SUBMIT_REQ& req) {
|
|||
retval = query_files(
|
||||
project_url,
|
||||
authenticator,
|
||||
req.batch_id,
|
||||
md5s,
|
||||
paths,
|
||||
md5s,
|
||||
req.batch_id,
|
||||
absent_files
|
||||
);
|
||||
if (retval) return retval;
|
||||
|
@ -129,9 +129,9 @@ int process_input_files(SUBMIT_REQ& req) {
|
|||
retval = upload_files(
|
||||
project_url,
|
||||
authenticator,
|
||||
req.batch_id,
|
||||
upload_paths,
|
||||
upload_md5s,
|
||||
upload_paths
|
||||
req.batch_id
|
||||
);
|
||||
if (retval) return retval;
|
||||
return 0;
|
||||
|
|
|
@ -111,9 +111,9 @@ static int do_http_post(
|
|||
int query_files(
|
||||
const char* project_url,
|
||||
const char* authenticator,
|
||||
int batch_id,
|
||||
vector<string> &md5s,
|
||||
vector<string> &paths,
|
||||
vector<string> &md5s,
|
||||
int batch_id,
|
||||
vector<int> &absent_files
|
||||
) {
|
||||
string req_msg;
|
||||
|
@ -157,9 +157,9 @@ int query_files(
|
|||
int upload_files (
|
||||
const char* project_url,
|
||||
const char* authenticator,
|
||||
int batch_id,
|
||||
vector<string> &paths,
|
||||
vector<string> &md5s,
|
||||
vector<string> &paths
|
||||
int batch_id
|
||||
) {
|
||||
char buf[1024];
|
||||
string req_msg = "<upload_files>\n";
|
||||
|
|
|
@ -73,18 +73,18 @@ struct FETCH_OUTPUT_REQ {
|
|||
extern int query_files(
|
||||
const char* project_url,
|
||||
const char* authenticator,
|
||||
int batch_id,
|
||||
vector<string> &md5s,
|
||||
vector<string> &paths,
|
||||
vector<string> &md5s,
|
||||
int batch_id,
|
||||
vector<int> &absent_files
|
||||
);
|
||||
|
||||
extern int upload_files (
|
||||
const char* project_url,
|
||||
const char* authenticator,
|
||||
int batch_id,
|
||||
vector<string> &paths,
|
||||
vector<string> &md5s,
|
||||
vector<string> &paths
|
||||
int batch_id
|
||||
);
|
||||
|
||||
extern int create_batch(
|
||||
|
|
Loading…
Reference in New Issue