mirror of https://github.com/BOINC/boinc.git
- client: fix uninitialized vars in CPU feature detection (from RustyBSD)
This commit is contained in:
parent
f31a63b0c8
commit
016b11e522
|
@ -7000,3 +7000,14 @@ David 22 Nov 2012
|
|||
|
||||
sched/
|
||||
handle_request.cpp
|
||||
|
||||
David 23 Nov 2012
|
||||
- client: fix uninitialized vars in CPU feature detection (from RustyBSD)
|
||||
|
||||
client/
|
||||
hostinfo_unix.cpp
|
||||
html/
|
||||
inc/
|
||||
submit.inc
|
||||
user/
|
||||
sandbox.php
|
||||
|
|
|
@ -628,9 +628,10 @@ static void parse_cpuinfo_linux(HOST_INFO& host) {
|
|||
|
||||
void use_cpuid(HOST_INFO& host) {
|
||||
u_int p[4];
|
||||
int hasMMX, hasSSE, hasSSE2, hasSSE3, has3DNow, has3DNowExt = 0;
|
||||
int hasMMX, hasSSE, hasSSE2, hasSSE3, has3DNow, has3DNowExt;
|
||||
char capabilities[256];
|
||||
|
||||
hasMMX = hasSSE = hasSSE2 = hasSSE3 = has3DNow = has3DNowExt = 0;
|
||||
do_cpuid(0x0, p);
|
||||
|
||||
if (p[0] >= 0x1) {
|
||||
|
@ -652,12 +653,12 @@ void use_cpuid(HOST_INFO& host) {
|
|||
}
|
||||
|
||||
capabilities[0] = '\0';
|
||||
if (hasSSE) strncat(capabilities, "sse ", 4);
|
||||
if (hasSSE2) strncat(capabilities, "sse2 ", 5);
|
||||
if (hasSSE3) strncat(capabilities, "sse3 ", 5);
|
||||
if (has3DNow) strncat(capabilities, "3dnow ", 6);
|
||||
if (has3DNowExt) strncat(capabilities, "3dnowext ", 9);
|
||||
if (hasMMX) strncat(capabilities, "mmx ", 4);
|
||||
if (hasSSE) strcat(capabilities, "sse ");
|
||||
if (hasSSE2) strcat(capabilities, "sse2 ");
|
||||
if (hasSSE3) strcat(capabilities, "sse3 ");
|
||||
if (has3DNow) strcat(capabilities, "3dnow ");
|
||||
if (has3DNowExt) strcat(capabilities, "3dnowext ");
|
||||
if (hasMMX) strcat(capabilities, "mmx ");
|
||||
strip_whitespace(capabilities);
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "%s [] [%s]",
|
||||
|
@ -1338,7 +1339,7 @@ int HOST_INFO::get_host_info() {
|
|||
m_nbytes = (double)sysconf(_SC_PAGESIZE) * (double)sysconf(_SC_PHYS_PAGES);
|
||||
if (m_nbytes < 0) {
|
||||
msg_printf(NULL, MSG_INTERNAL_ERROR,
|
||||
"RAM size not measured correctly: page size %d, #pages %d",
|
||||
"RAM size not measured correctly: page size %ld, #pages %ld",
|
||||
sysconf(_SC_PAGESIZE), sysconf(_SC_PHYS_PAGES)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,8 @@ function req_to_xml($req, $op) {
|
|||
$x .= " <mode>$file->mode</mode>\n";
|
||||
switch ($file->mode) {
|
||||
case "remote":
|
||||
$x .= " <source>$file->source</source>\n";
|
||||
break;
|
||||
case "local":
|
||||
$x .= " <path>$file->path</path>\n";
|
||||
break;
|
||||
|
@ -65,7 +67,7 @@ function req_to_xml($req, $op) {
|
|||
case "semilocal":
|
||||
$x .= " <url>$file->url</url>\n";
|
||||
break;
|
||||
<source>$file->source</source>
|
||||
}
|
||||
$x .= " </input_file>\n";
|
||||
}
|
||||
$x .= " </job>
|
||||
|
|
|
@ -52,7 +52,7 @@ function list_files($user, $err_msg) {
|
|||
</form>
|
||||
<hr>
|
||||
";
|
||||
if(strcmp($err_msg,"")!=0){
|
||||
if (strcmp($err_msg,"")!=0){
|
||||
echo "<p>$err_msg<hr>";
|
||||
}
|
||||
$files = array();
|
||||
|
@ -67,7 +67,7 @@ function list_files($user, $err_msg) {
|
|||
sort($files);
|
||||
start_table();
|
||||
table_header("Name<br><span class=note>(click to view)</span>", "Modified", "Size (bytes)", "MD5", "Delete","Download");
|
||||
foreach($files as $f) {
|
||||
foreach ($files as $f) {
|
||||
$path = "$dir/$f";
|
||||
list($error, $size, $md5) = sandbox_parse_link_file($path);
|
||||
if ($error) {
|
||||
|
@ -102,36 +102,36 @@ function list_files($user, $err_msg) {
|
|||
|
||||
function upload_file($user) {
|
||||
$tmp_name = $_FILES['new_file']['tmp_name'];
|
||||
if (is_uploaded_file($tmp_name)) {
|
||||
$name = $_FILES['new_file']['name'];
|
||||
if (strstr($name, "/")) {
|
||||
error_page("no / allowed");
|
||||
}
|
||||
$md5 = md5_file($tmp_name);
|
||||
$s = stat($tmp_name);
|
||||
$size = $s['size'];
|
||||
list($exist,$elf) = sandbox_lf_exist($user,$md5);
|
||||
if ($exist){
|
||||
$notice = "<strong>Notice:</strong> Invalid Upload<br/>";
|
||||
$notice .= "You are trying to upload file <strong>$name</strong><br/>";
|
||||
$notice .= "Another file <strong>$elf</strong> with the same content(md5: $md5) already exist!<br/>";
|
||||
list_files($user,$notice);
|
||||
return;
|
||||
} else{
|
||||
// move file to download dir
|
||||
//
|
||||
$phys_path = sandbox_physical_path($user, $md5);
|
||||
rename($tmp_name, $phys_path);
|
||||
if (!is_uploaded_file($tmp_name)) {
|
||||
error_page("$tmp_name is not uploaded file");
|
||||
}
|
||||
$name = $_FILES['new_file']['name'];
|
||||
if (strstr($name, "/")) {
|
||||
error_page("no / allowed");
|
||||
}
|
||||
$md5 = md5_file($tmp_name);
|
||||
$s = stat($tmp_name);
|
||||
$size = $s['size'];
|
||||
list($exist, $elf) = sandbox_lf_exist($user, $md5);
|
||||
if ($exist){
|
||||
$notice = "<strong>Notice:</strong> Invalid Upload<br/>";
|
||||
$notice .= "You are trying to upload file <strong>$name</strong><br/>";
|
||||
$notice .= "Another file <strong>$elf</strong> with the same content(md5: $md5) already exist!<br/>";
|
||||
} else{
|
||||
// move file to download dir
|
||||
//
|
||||
$phys_path = sandbox_physical_path($user, $md5);
|
||||
rename($tmp_name, $phys_path);
|
||||
|
||||
// write link file
|
||||
//
|
||||
$dir = sandbox_dir($user);
|
||||
$link_path = "$dir/$name";
|
||||
sandbox_write_link_file($link_path, $size, $md5);
|
||||
// write link file
|
||||
//
|
||||
$dir = sandbox_dir($user);
|
||||
$link_path = "$dir/$name";
|
||||
sandbox_write_link_file($link_path, $size, $md5);
|
||||
$notice = "Successfully uploaded file <strong>$name</strong>!<br/>";
|
||||
list_files($user,$notice);
|
||||
}
|
||||
}
|
||||
list_files($user, $notice);
|
||||
}
|
||||
|
||||
function delete_file($user) {
|
||||
|
@ -145,7 +145,7 @@ function delete_file($user) {
|
|||
if (!is_file($p)) {
|
||||
error_page("no such physical file");
|
||||
}
|
||||
$bused = sandbox_file_in_use($user,$name);
|
||||
$bused = sandbox_file_in_use($user, $name);
|
||||
if ($bused){
|
||||
$notice = "<strong>$name</strong> is being used by batch(es), you can not delete it now!<br/>";
|
||||
} else{
|
||||
|
@ -161,14 +161,14 @@ function download_file($user) {
|
|||
$name = get_str('name');
|
||||
$dir = sandbox_dir($user);
|
||||
list($err, $size, $md5) = sandbox_parse_link_file("$dir/$name");
|
||||
if($err) {
|
||||
if ($err) {
|
||||
error_page("can't parse link file");
|
||||
}
|
||||
$p = sandbox_physical_path($user, $md5);
|
||||
if (!is_file($p)) {
|
||||
error_page("$p does not exist!");
|
||||
}
|
||||
do_download($p,$name);
|
||||
do_download($p, $name);
|
||||
}
|
||||
function view_file($user) {
|
||||
$name = get_str('name');
|
||||
|
|
Loading…
Reference in New Issue