mirror of https://github.com/BOINC/boinc.git
- client: bug fixes in gzipped download code
svn path=/trunk/boinc/; revision=25141
This commit is contained in:
parent
dc6227429d
commit
36c6c529a2
|
@ -963,3 +963,10 @@ David 24 Jan 2012
|
|||
|
||||
client/
|
||||
client_types.cpp
|
||||
|
||||
David 24 Jan 2012
|
||||
- client: bug fixes in gzipped download code
|
||||
|
||||
client/
|
||||
client_types.cpp
|
||||
cs_files.cpp
|
||||
|
|
|
@ -1073,7 +1073,7 @@ int FILE_INFO::write(MIOFILE& out, bool to_server) {
|
|||
if (uploaded) out.printf(" <uploaded/>\n");
|
||||
if (sticky) out.printf(" <sticky/>\n");
|
||||
if (gzip_when_done) out.printf(" <gzip_when_done/>\n");
|
||||
if (download_gzipped) out.printf(" <download_gzipped>\n");
|
||||
if (download_gzipped) out.printf(" <download_gzipped/>\n");
|
||||
if (signature_required) out.printf(" <signature_required/>\n");
|
||||
if (is_user_file) out.printf(" <is_user_file/>\n");
|
||||
if (strlen(file_signature)) out.printf(" <file_signature>\n%s\n</file_signature>\n", file_signature);
|
||||
|
@ -1152,14 +1152,11 @@ int FILE_INFO::delete_file() {
|
|||
// files with download_gzipped set may exist
|
||||
// in temporary or compressed form
|
||||
//
|
||||
if (retval) {
|
||||
strcat(path, ".gz");
|
||||
retval = delete_project_owned_file(path, true);
|
||||
}
|
||||
if (retval) {
|
||||
strcat(path, "t");
|
||||
retval = delete_project_owned_file(path, true);
|
||||
}
|
||||
strcat(path, ".gz");
|
||||
delete_project_owned_file(path, true);
|
||||
strcat(path, "t");
|
||||
delete_project_owned_file(path, true);
|
||||
|
||||
if (retval && status != FILE_NOT_PRESENT) {
|
||||
msg_printf(project, MSG_INTERNAL_ERROR, "Couldn't delete file %s", path);
|
||||
}
|
||||
|
@ -1303,13 +1300,13 @@ int FILE_INFO::gunzip() {
|
|||
get_pathname(this, outpath, sizeof(outpath));
|
||||
strcpy(inpath, outpath);
|
||||
strcat(inpath, ".gz");
|
||||
FILE* out = boinc_fopen(outpath, "rb");
|
||||
FILE* out = boinc_fopen(outpath, "wb");
|
||||
if (!out) return ERR_FOPEN;
|
||||
gzFile in = gzopen(inpath, "rb");
|
||||
while (1) {
|
||||
int n = gzread(in, buf, BUFSIZE);
|
||||
if (n <= 0) break;
|
||||
int m = (int)fwrite(buf, 1, BUFSIZE, out);
|
||||
int m = (int)fwrite(buf, 1, n, out);
|
||||
if (m != n) {
|
||||
gzclose(in);
|
||||
fclose(out);
|
||||
|
@ -1319,7 +1316,6 @@ int FILE_INFO::gunzip() {
|
|||
gzclose(in);
|
||||
fclose(out);
|
||||
delete_project_owned_file(inpath, true);
|
||||
boinc_rename(outpath, inpath);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,12 +131,20 @@ int FILE_INFO::verify_file(bool strict, bool show_errors) {
|
|||
|
||||
get_pathname(this, pathname, sizeof(pathname));
|
||||
|
||||
if (download_gzipped) {
|
||||
// see if we need to unzip it
|
||||
//
|
||||
if (download_gzipped && !boinc_file_exists(pathname)) {
|
||||
char gzpath[256];
|
||||
sprintf(gzpath, "%s.gz", pathname);
|
||||
if (boinc_file_exists(gzpath) && !boinc_file_exists(pathname)) {
|
||||
if (boinc_file_exists(gzpath) ) {
|
||||
retval = gunzip();
|
||||
if (retval) return retval;
|
||||
} else {
|
||||
strcat(gzpath, "t");
|
||||
if (!boinc_file_exists(gzpath)) {
|
||||
status = FILE_NOT_PRESENT;
|
||||
}
|
||||
return ERR_FILE_MISSING;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue