diff --git a/sched/timeout_check.C b/sched/timeout_check.C
index 0e08f00d7d..08936a2fcc 100644
--- a/sched/timeout_check.C
+++ b/sched/timeout_check.C
@@ -117,8 +117,7 @@ int assign_new_names(char* in) {
n1 += strlen("");
n2 = strstr(p, "");
if (!n2) {
- sprintf(buf, "assign_new_names(): malformed XML:\n%s", in);
- write_log(buf, MSG_CRITICAL);
+ write_log(MSG_CRITICAL, "assign_new_names(): malformed XML:\n%s", in);
return 1;
}
len = n2 - n1;
@@ -135,8 +134,7 @@ int assign_new_names(char* in) {
sprintf(element, "%s", name);
n2 = strstr(n1, element);
if (!n2) {
- sprintf(buf, "assign_new_names(): no :\n%s", in);
- write_log(buf, MSG_CRITICAL);
+ write_log(MSG_CRITICAL, "assign_new_names(): no :\n%s", in);
return 1;
}
strcpy(buf, n2+strlen(element));
@@ -183,8 +181,7 @@ void handle_wu(DB_WORKUNIT& wu) {
case RESULT_SERVER_STATE_OVER:
switch (result.outcome) {
case RESULT_OUTCOME_COULDNT_SEND:
- sprintf(buf, "WU %s has couldn't-send result\n", wu.name);
- write_log(buf, MSG_NORMAL);
+ write_log(MSG_NORMAL, "WU %s has couldn't-send result\n", wu.name);
wu.error_mask |= WU_ERROR_COULDNT_SEND_RESULT;
wu_error = true;
break;
@@ -202,14 +199,12 @@ void handle_wu(DB_WORKUNIT& wu) {
// check for too many errors or too many results
//
if (nerrors > max_errors) {
- sprintf(buf, "WU %s has too many errors\n", wu.name);
- write_log(buf, MSG_NORMAL);
+ write_log(MSG_NORMAL, "WU %s has too many errors\n", wu.name);
wu.error_mask |= WU_ERROR_TOO_MANY_ERROR_RESULTS;
wu_error = true;
}
if (ndone > max_done) {
- sprintf(buf, "WU %s has too many answers\n", wu.name);
- write_log(buf, MSG_NORMAL);
+ write_log(MSG_NORMAL, "WU %s has too many answers\n", wu.name);
wu.error_mask |= WU_ERROR_TOO_MANY_RESULTS;
wu_error = true;
}
@@ -246,8 +241,7 @@ void handle_wu(DB_WORKUNIT& wu) {
add_signatures(result.xml_doc_in, key);
retval = result.insert();
if (retval) {
- sprintf(buf, "result.insert() %d\n", retval);
- write_log(buf, MSG_CRITICAL);
+ write_log(MSG_CRITICAL, "result.insert() %d\n", retval);
break;
}
}
@@ -275,8 +269,7 @@ void handle_wu(DB_WORKUNIT& wu) {
retval = wu.update();
if (retval) {
- sprintf(buf, "workunit.update() %d\n", retval);
- write_log(buf, MSG_CRITICAL);
+ write_log(MSG_CRITICAL, "workunit.update() %d\n", retval);
}
}
@@ -303,16 +296,14 @@ void main_loop(bool one_pass) {
retval = boinc_db_open(config.db_name, config.db_passwd);
if (retval) {
- sprintf(buf, "boinc_db_open: %d\n", retval);
- write_log(buf, MSG_CRITICAL);
+ write_log(MSG_CRITICAL, "boinc_db_open: %d\n", retval);
exit(1);
}
sprintf(buf, "where name='%s'", app_name);
retval = app.lookup(buf);
if (retval) {
- sprintf(buf, "can't find app %s\n", app.name);
- write_log(buf, MSG_CRITICAL);
+ write_log(MSG_CRITICAL, "can't find app %s\n", app.name);
exit(1);
}
@@ -352,14 +343,14 @@ int main(int argc, char** argv) {
retval = config.parse_file();
if (retval) {
- fprintf(stderr, "can't read config file\n");
+ write_log(MSG_CRITICAL, "can't read config file\n");
exit(1);
}
sprintf(path, "%s/upload_private", config.key_dir);
retval = read_key_file(path, key);
if (retval) {
- fprintf(stderr, "can't read key\n");
+ write_log(MSG_CRITICAL, "can't read key\n");
exit(1);
}
@@ -371,7 +362,7 @@ int main(int argc, char** argv) {
// Call lock_file after fork(), because file locks are not always inherited
if (lock_file(LOCKFILE)) {
- fprintf(stderr, "Another copy of timeout_check is already running\n");
+ write_log(MSG_NORMAL, "Another copy of timeout_check is already running\n");
exit(1);
}
write_pid_file(PIDFILE);