*** empty log message ***

svn path=/trunk/boinc/; revision=2680
This commit is contained in:
Karl Chen 2003-11-25 07:40:45 +00:00
parent 8203c216ed
commit 57fc665a91
3 changed files with 44 additions and 7 deletions

View File

@ -7776,7 +7776,14 @@ Karl 2003-11-22
client_types.C
Karl 2003-11-24
- testbase fixes
- fixed bug in boinc_db.C which causes SQL lookups to seg fault if any of
the 'seti_*' grandfather fields are NULL (how does the current beta test
run at all?!)
db/
boinc_db.C
- testbase tweaks
test/
testbase.py

View File

@ -32,6 +32,18 @@ static struct random_init {
}
} random_init;
// if SQL columns are not 'not null', you must use these safe_atoi, safe_atof
// instead of atoi, atof, since the strings returned by MySQL may be NULL.
inline int safe_atoi(const char* s)
{
return s && atoi(s);
}
inline float safe_atof(const char* s)
{
return s && atof(s);
}
void PROJECT::clear() {memset(this, 0, sizeof(*this));}
void PLATFORM::clear() {memset(this, 0, sizeof(*this));}
void CORE_VERSION::clear() {memset(this, 0, sizeof(*this));}
@ -236,11 +248,11 @@ void DB_USER::db_parse(MYSQL_ROW &r) {
strcpy2(url, r[i++]);
send_email = atoi(r[i++]);
show_hosts = atoi(r[i++]);
posts = atoi(r[i++]);
seti_id = atoi(r[i++]);
seti_nresults = atoi(r[i++]);
seti_last_result_time = atoi(r[i++]);
seti_total_cpu = atof(r[i++]);
posts = safe_atoi(r[i++]);
seti_id = safe_atoi(r[i++]);
seti_nresults = safe_atoi(r[i++]);
seti_last_result_time = safe_atoi(r[i++]);
seti_total_cpu = safe_atof(r[i++]);
}
void DB_TEAM::db_print(char* buf){
@ -293,7 +305,7 @@ void DB_TEAM::db_parse(MYSQL_ROW &r) {
strcpy2(country, r[i++]);
total_credit = atof(r[i++]);
expavg_credit = atof(r[i++]);
seti_id = atoi(r[i++]);
seti_id = safe_atoi(r[i++]);
}
void DB_HOST::db_print(char* buf){

View File

@ -5,6 +5,7 @@
import BaseHTTPServer, CGIHTTPServer
import sys, os, urllib, select
import random, time # XXX
php_path = None
possible_php_paths = [ '/usr/lib/cgi-bin/php4',
@ -159,6 +160,23 @@ class PHPHTTPRequestHandler(CGIHTTPServer.CGIHTTPRequestHandler):
return
# Child
try:
if 0:
time.sleep(.1)
fn = '/tmp/a%d'%random.randint(1000,10000)
f = open(fn, 'w')
s = ''
while select.select([self.rfile], [], [], 0)[0]:
try:
c = self.rfile.read(1)
if not c:
break
s += c
except:
break
print '### input:', repr(s)
print >>f, s
f.close()
self.rfile = open(fn, 'r')
os.dup2(self.rfile.fileno(), 0)
os.dup2(self.wfile.fileno(), 1)
os.chdir(self.translate_path(dir)) # KC