[SCM] BOINC packaging branch, master, updated. debian/6.10.17+dfsg-3-384-g4fd006b
Steffen Moeller
moeller at debian.org
Wed Feb 15 21:02:15 UTC 2012
The following commit has been merged in the master branch:
commit a268708d8803e71ddcb84559c3c4e8a72c22cdd6
Author: Steffen Moeller <moeller at debian.org>
Date: Wed Feb 15 21:16:20 2012 +0100
Playground of patches.
diff --git a/debian/patches/cppcheck_more.patch b/debian/patches/cppcheck_more.patch
new file mode 100644
index 0000000..9431e0f
--- /dev/null
+++ b/debian/patches/cppcheck_more.patch
@@ -0,0 +1,13 @@
+Index: boinc/lib/mac_address.cpp
+===================================================================
+--- boinc.orig/lib/mac_address.cpp 2012-02-03 22:45:40.000000000 +0100
++++ boinc/lib/mac_address.cpp 2012-02-12 21:23:40.000000000 +0100
+@@ -147,7 +147,7 @@
+ // valid, no buffer overflow
+ PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo; // Contains pointer to current adapter info
+ do {
+- sprintf(addresses, "%s%s%02x:%02x:%02x:%02x:%02x:%02x", addresses, delimiter,
++ sprintf(addresses, "%s%s%02x:%02x:%02x:%02x:%02x:%02x", "", delimiter,
+ pAdapterInfo->Address[0], pAdapterInfo->Address[1], pAdapterInfo->Address[2],
+ pAdapterInfo->Address[3], pAdapterInfo->Address[4], pAdapterInfo->Address[5]);
+ delimiter[0] = ':';
diff --git a/debian/patches/cppcheck_realloc.patch b/debian/patches/cppcheck_realloc.patch
new file mode 100644
index 0000000..ef1a1a9
--- /dev/null
+++ b/debian/patches/cppcheck_realloc.patch
@@ -0,0 +1,93 @@
+Index: boinc/lib/parse.cpp
+===================================================================
+--- boinc.orig/lib/parse.cpp 2012-01-17 00:28:55.000000000 +0100
++++ boinc/lib/parse.cpp 2012-02-10 22:21:13.000000000 +0100
+@@ -178,8 +178,21 @@
+ }
+ int n = (int)strlen(line);
+ if (nused + n >= bufsize) {
+- bufsize *= 2;
+- buf = (char*)realloc(buf, bufsize);
++ char *b = (char*)realloc(buf, bufsize*2);
++ if (b) {
++ buf = b;
++ bufsize *= 2;
++ }
++ else {
++ b = (char*)realloc(buf, nused+n+2);
++ if (!b) {
++ fprintf(STDERR,"Ran out of memory.\n");
++ free(buf);
++ return ERR_XML_PARSE;
++ }
++ buffsize = nused+n+2;
++ buf = b;
++ }
+ }
+ strcpy(buf+nused, line);
+ nused += n;
+Index: boinc/lib/susp.cpp
+===================================================================
+--- boinc.orig/lib/susp.cpp 2011-03-17 18:51:04.000000000 +0100
++++ boinc/lib/susp.cpp 2012-02-10 22:25:31.000000000 +0100
+@@ -185,12 +185,13 @@
+
+ if (i >= bottom) {
+ bottom += 2;
+- array = (Victim_t*)realloc (
++ Victim_t *a= (Victim_t*)realloc (
+ array, (bottom * sizeof (Victim_t)));
+- if (array == NULL) {
++ if (a == NULL) {
+ pthread_mutex_unlock (&mut);
+ return errno;
+ }
++ array=a;
+ array[bottom-1].inuse = 0; /* Clear new last entry */
+ }
+
+Index: boinc/lib/crypt_prog.cpp
+===================================================================
+--- boinc.orig/lib/crypt_prog.cpp 2012-02-03 21:33:50.000000000 +0100
++++ boinc/lib/crypt_prog.cpp 2012-02-11 11:45:38.000000000 +0100
+@@ -109,6 +109,7 @@
+ die("can't open /dev/random\n");
+ }
+ fread(&n, sizeof(n), 1, f);
++ fclose(f);
+ #endif
+ return n;
+ }
+@@ -350,10 +351,10 @@
+ } else {
+ // o2b
+ rsa_key_ = (RSA *)calloc(1, sizeof(RSA));
+- memset(rsa_key_, 0, sizeof(RSA));
+ if (rsa_key_ == NULL) {
+ die("could not allocate memory for RSA structure.\n");
+ }
++ //memset(rsa_key_, 0, sizeof(RSA)); // redundant (calloc initiates with 0, needs to move after if
+ if (kpriv) {
+ fpriv = fopen (argv[4], "r");
+ rsa_key_ = PEM_read_RSAPrivateKey(fpriv, NULL, NULL, NULL);
+Index: boinc/lib/diagnostics_win.cpp
+===================================================================
+--- boinc.orig/lib/diagnostics_win.cpp 2011-03-17 18:51:04.000000000 +0100
++++ boinc/lib/diagnostics_win.cpp 2012-02-11 11:49:37.000000000 +0100
+@@ -331,6 +331,7 @@
+ *ppBuffer = HeapAlloc(hHeap, HEAP_ZERO_MEMORY, *pcbBuffer);
+ if (ppBuffer == NULL) {
+ retval = ERROR_NOT_ENOUGH_MEMORY;
++ return retval;
+ }
+
+ Status = pNTQSI(
+@@ -1638,6 +1639,8 @@
+ case 1: // write attempt
+ sprintf(substatus, "write attempt to address 0x%8.8X", pExPtrs->ExceptionRecord->ExceptionInformation[1]);
+ break;
++ default:// initialise substatus
++ substatus[0]=0;
+ }
+ }
+ fprintf(stderr, "Reason: %s (0x%x) at address 0x%p %s\n\n", status, exception_code, exception_address, substatus);
diff --git a/debian/patches/file_size_as_long.patch b/debian/patches/file_size_as_long.patch
new file mode 100644
index 0000000..13c0945
--- /dev/null
+++ b/debian/patches/file_size_as_long.patch
@@ -0,0 +1,183 @@
+Index: boinc/client/app.cpp
+===================================================================
+--- boinc.orig/client/app.cpp 2012-01-14 13:00:51.000000000 +0100
++++ boinc/client/app.cpp 2012-02-12 21:54:51.000000000 +0100
+@@ -427,7 +427,7 @@
+ // size of output files and files in slot dir
+ //
+ int ACTIVE_TASK::current_disk_usage(double& size) {
+- double x;
++ off_t x;
+ unsigned int i;
+ int retval;
+ FILE_INFO* fip;
+@@ -439,7 +439,7 @@
+ fip = result->output_files[i].file_info;
+ get_pathname(fip, path, sizeof(path));
+ retval = file_size(path, x);
+- if (!retval) size += x;
++ if (!retval) size += (double)x;
+ }
+ return 0;
+ }
+Index: boinc/client/cs_apps.cpp
+===================================================================
+--- boinc.orig/client/cs_apps.cpp 2011-10-30 00:27:06.000000000 +0200
++++ boinc/client/cs_apps.cpp 2012-02-12 21:56:12.000000000 +0100
+@@ -102,7 +102,7 @@
+ unsigned int i;
+ char path[256];
+ int retval;
+- double size;
++ off_t size;
+
+ // scan the output files, check if missing or too big.
+ // Don't bother doing this if result was aborted via GUI or by project
+Index: boinc/client/file_xfer.cpp
+===================================================================
+--- boinc.orig/client/file_xfer.cpp 2012-02-03 21:33:49.000000000 +0100
++++ boinc/client/file_xfer.cpp 2012-02-12 22:02:35.000000000 +0100
+@@ -239,7 +239,7 @@
+ bool action = false;
+ static double last_time=0;
+ char pathname[256];
+- double size;
++ off_t size;
+
+ if (gstate.now - last_time < FILE_XFER_POLL_PERIOD) return false;
+ last_time = gstate.now;
+@@ -309,7 +309,7 @@
+ if (!fxp->is_upload) {
+ get_pathname(fxp->fip, pathname, sizeof(pathname));
+ if (file_size(pathname, size)) continue;
+- double diff = size - fxp->starting_size;
++ off_t diff = size - fxp->starting_size;
+ if (fxp->http_op_retval == 0) {
+ // If no HTTP error,
+ // see if we read less than 5 KB and file is incomplete.
+Index: boinc/client/file_xfer.h
+===================================================================
+--- boinc.orig/client/file_xfer.h 2011-03-17 18:51:03.000000000 +0100
++++ boinc/client/file_xfer.h 2012-02-12 21:58:03.000000000 +0100
+@@ -37,7 +37,7 @@
+ char header[4096];
+ bool file_size_query;
+ bool is_upload;
+- double starting_size;
++ off_t starting_size;
+ // File size at start of transfer, used for:
+ // 1) a "minimum download increment"
+ // that rejects partial downloads of less than 5K,
+Index: boinc/client/http_curl.cpp
+===================================================================
+--- boinc.orig/client/http_curl.cpp 2012-02-03 21:33:49.000000000 +0100
++++ boinc/client/http_curl.cpp 2012-02-12 22:03:23.000000000 +0100
+@@ -303,7 +303,7 @@
+ PROJECT* p, const char* url, const char* in, const char* out
+ ) {
+ int retval;
+- double size;
++ off_t size;
+
+ req1 = NULL; // not using req1, but init_post2 uses it
+
+Index: boinc/client/pers_file_xfer.h
+===================================================================
+--- boinc.orig/client/pers_file_xfer.h 2011-12-15 20:51:06.000000000 +0100
++++ boinc/client/pers_file_xfer.h 2012-02-12 22:00:06.000000000 +0100
+@@ -95,7 +95,7 @@
+ double last_time;
+ // when the above was last updated.
+ // Defined only while a transfer is active
+- double last_bytes_xferred;
++ off_t last_bytes_xferred;
+ // Save how much is transferred when transfer isn't active, used
+ // to display progress in GUI.
+ bool pers_xfer_done;
+Index: boinc/lib/diagnostics.cpp
+===================================================================
+--- boinc.orig/lib/diagnostics.cpp 2011-10-30 00:27:06.000000000 +0200
++++ boinc/lib/diagnostics.cpp 2012-02-12 21:52:39.000000000 +0100
+@@ -501,7 +501,7 @@
+ // Cycle the log files at regular events.
+ //
+ int diagnostics_cycle_logs() {
+- double f_size;
++ off_t i_size;
+
+ fflush(stdout);
+ fflush(stderr);
+@@ -513,11 +513,11 @@
+ // OS/2 can't stat() open files!
+ struct stat sbuf;
+ fstat(fileno(stderr_file), &sbuf);
+- f_size = (double)sbuf.st_size;
++ i_size = sbuf.st_size;
+ #else
+- file_size(stderr_log, f_size);
++ file_size(stderr_log, i_size);
+ #endif
+- if (f_size > max_stderr_file_size) {
++ if (i_size > max_stderr_file_size) {
+ if (NULL == stderr_file) return ERR_FOPEN;
+ fclose(stderr_file);
+ boinc_copy(stderr_log, stderr_archive);
+@@ -531,11 +531,11 @@
+ // OS/2 can't stat() open files!
+ struct stat sbuf;
+ fstat(fileno(stdout_file), &sbuf);
+- f_size = (double)sbuf.st_size;
++ i_size = sbuf.st_size;
+ #else
+- file_size(stdout_log, f_size);
++ file_size(stdout_log, i_size);
+ #endif
+- if (f_size > max_stdout_file_size) {
++ if (i_size > max_stdout_file_size) {
+ if (NULL == stdout_file) return ERR_FOPEN;
+ fclose(stdout_file);
+ boinc_copy(stdout_log, stdout_archive);
+Index: boinc/lib/filesys.cpp
+===================================================================
+--- boinc.orig/lib/filesys.cpp 2012-01-16 22:23:26.000000000 +0100
++++ boinc/lib/filesys.cpp 2012-02-12 21:41:11.000000000 +0100
+@@ -316,6 +316,16 @@
+
+ // get file size
+ //
++int file_size(const char* const path, off_t& size) {
++ struct stat sbuf;
++ int retval;
++
++ retval = stat(path, &sbuf);
++ if (retval) return ERR_NOT_FOUND;
++ size = sbuf.st_size;
++ return 0;
++}
++
+ int file_size(const char* path, double& size) {
+ struct stat sbuf;
+ int retval;
+@@ -403,7 +413,7 @@
+ char filename[1024], subdir[1024];
+ int retval=0;
+ DIRREF dirp;
+- double x;
++ off_t x;
+
+ size = 0;
+ dirp = dir_open(dirpath);
+Index: boinc/lib/filesys.h
+===================================================================
+--- boinc.orig/lib/filesys.h 2011-12-02 02:55:55.000000000 +0100
++++ boinc/lib/filesys.h 2012-02-12 21:39:41.000000000 +0100
+@@ -71,7 +71,8 @@
+ /* C++ specific prototypes/defines follow here */
+ #ifdef __cplusplus
+
+-extern int file_size(const char*, double&);
++extern int file_size(const char const* path, off_t& size);
++extern int file_size(const char* path, double& size);
+ extern int clean_out_dir(const char*);
+ extern int dir_size(const char* dirpath, double&, bool recurse=true);
+ extern int get_filesystem_info(double& total, double& free, char* path=const_cast<char *>("."));
diff --git a/debian/patches/series b/debian/patches/series
index 038f211..1708133 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -18,3 +18,5 @@ stripchart_security.patch
#andYetMorePatches04.patch
#erase_while_1.patch
redundant_i.patch
+cppcheck_more.patch
+cppcheck_realloc.patch
--
BOINC packaging
More information about the pkg-boinc-commits
mailing list