Commit 58366ffd authored by Roger Dingledine's avatar Roger Dingledine
Browse files

when we changed from log_fn to debug/info/notice/warn/err,

we screwed up the formatting in wild and unpredictable ways.

fix it before it becomes convention to format logs in wild and
unpredictable ways.

still need to do src/common/ someday.


svn:r5551
parent 9b0a40ec
......@@ -285,7 +285,7 @@ buf_shrink(buf_t *buf)
return;
debug(LD_MM,"Shrinking buffer from %d to %d bytes.",
(int)buf->len, (int)new_len);
(int)buf->len, (int)new_len);
buf_resize(buf, new_len);
}
......@@ -413,7 +413,7 @@ read_to_buf_impl(int s, size_t at_most, buf_t *buf,
if (buf->datalen > buf->highwater)
buf->highwater = buf->datalen;
debug(LD_NET,"Read %d bytes. %d on inbuf.",read_result,
(int)buf->datalen);
(int)buf->datalen);
return read_result;
}
}
......@@ -479,8 +479,8 @@ read_to_buf_tls_impl(tor_tls_t *tls, size_t at_most, buf_t *buf, char *next)
int r;
debug(LD_NET,"before: %d on buf, %d pending, at_most %d.",
(int)buf_datalen(buf), (int)tor_tls_get_pending_bytes(tls),
(int)at_most);
(int)buf_datalen(buf), (int)tor_tls_get_pending_bytes(tls),
(int)at_most);
r = tor_tls_read(tls, next, at_most);
if (r<0)
return r;
......@@ -489,7 +489,7 @@ read_to_buf_tls_impl(tor_tls_t *tls, size_t at_most, buf_t *buf, char *next)
if (buf->datalen > buf->highwater)
buf->highwater = buf->datalen;
debug(LD_NET,"Read %d bytes. %d on inbuf; %d pending",r,
(int)buf->datalen,(int)tor_tls_get_pending_bytes(tls));
(int)buf->datalen,(int)tor_tls_get_pending_bytes(tls));
return r;
}
......@@ -523,8 +523,8 @@ read_to_buf_tls(tor_tls_t *tls, size_t at_most, buf_t *buf)
assert_buf_ok(buf);
debug(LD_NET,"start: %d on buf, %d pending, at_most %d.",
(int)buf_datalen(buf), (int)tor_tls_get_pending_bytes(tls),
(int)at_most);
(int)buf_datalen(buf), (int)tor_tls_get_pending_bytes(tls),
(int)at_most);
if (buf_ensure_capacity(buf, at_most+buf->datalen))
return TOR_TLS_ERROR;
......@@ -610,7 +610,7 @@ flush_buf(int s, buf_t *buf, size_t sz, size_t *buf_flushlen)
check();
debug(LD_NET,"%d: flushed %d bytes, %d ready to flush, %d remain.",
s,r,(int)*buf_flushlen,(int)buf->datalen);
s,r,(int)*buf_flushlen,(int)buf->datalen);
if (r < 0 || (size_t)r < flushlen0)
return r; /* Error, or can't flush any more now. */
flushed = r;
......@@ -620,7 +620,7 @@ flush_buf(int s, buf_t *buf, size_t sz, size_t *buf_flushlen)
r = flush_buf_impl(s, buf, flushlen1, buf_flushlen);
check();
debug(LD_NET,"%d: flushed %d bytes, %d ready to flush, %d remain.",
s,r,(int)*buf_flushlen,(int)buf->datalen);
s,r,(int)*buf_flushlen,(int)buf->datalen);
if (r<0)
return r;
flushed += r;
......@@ -645,7 +645,7 @@ flush_buf_tls_impl(tor_tls_t *tls, buf_t *buf, size_t sz, size_t *buf_flushlen)
*buf_flushlen -= r;
buf_remove_from_front(buf, r);
debug(LD_NET,"flushed %d bytes, %d ready to flush, %d remain.",
r,(int)*buf_flushlen,(int)buf->datalen);
r,(int)*buf_flushlen,(int)buf->datalen);
return r;
}
......@@ -706,7 +706,8 @@ write_to_buf(const char *string, size_t string_len, buf_t *buf)
/* assert_buf_ok(buf); */
if (buf_ensure_capacity(buf, buf->datalen+string_len)) {
warn(LD_MM, "buflen too small, can't hold %d bytes.", (int)(buf->datalen+string_len));
warn(LD_MM, "buflen too small, can't hold %d bytes.",
(int)(buf->datalen+string_len));
return -1;
}
......@@ -726,7 +727,7 @@ write_to_buf(const char *string, size_t string_len, buf_t *buf)
if (buf->datalen > buf->highwater)
buf->highwater = buf->datalen;
debug(LD_NET,"added %d bytes to buf (now %d total).",
(int)string_len, (int)buf->datalen);
(int)string_len, (int)buf->datalen);
check();
return buf->datalen;
}
......@@ -822,12 +823,13 @@ fetch_from_buf_http(buf_t *buf,
debug(LD_HTTP,"headerlen %d, bodylen %d.", (int)headerlen, (int)bodylen);
if (max_headerlen <= headerlen) {
warn(LD_HTTP,"headerlen %d larger than %d. Failing.", (int)headerlen,
(int)max_headerlen-1);
warn(LD_HTTP,"headerlen %d larger than %d. Failing.",
(int)headerlen, (int)max_headerlen-1);
return -1;
}
if (max_bodylen <= bodylen) {
warn(LD_HTTP,"bodylen %d larger than %d. Failing.", (int)bodylen, (int)max_bodylen-1);
warn(LD_HTTP,"bodylen %d larger than %d. Failing.",
(int)bodylen, (int)max_bodylen-1);
return -1;
}
......@@ -945,7 +947,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
req->command != SOCKS_COMMAND_RESOLVE) {
/* not a connect or resolve? we don't support it. */
warn(LD_APP,"socks5: command %d not recognized. Rejecting.",
req->command);
req->command);
return -1;
}
switch (*(buf->cur+3)) { /* address type */
......@@ -959,7 +961,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf));
if (strlen(tmpbuf)+1 > MAX_SOCKS_ADDR_LEN) {
warn(LD_APP,"socks5 IP takes %d bytes, which doesn't fit in %d. Rejecting.",
(int)strlen(tmpbuf)+1,(int)MAX_SOCKS_ADDR_LEN);
(int)strlen(tmpbuf)+1,(int)MAX_SOCKS_ADDR_LEN);
return -1;
}
strlcpy(req->address,tmpbuf,sizeof(req->address));
......@@ -983,7 +985,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
return 0; /* not yet */
if (len+1 > MAX_SOCKS_ADDR_LEN) {
warn(LD_APP,"socks5 hostname is %d bytes, which doesn't fit in %d. Rejecting.",
len+1,MAX_SOCKS_ADDR_LEN);
len+1,MAX_SOCKS_ADDR_LEN);
return -1;
}
memcpy(req->address,buf->cur+5,len);
......@@ -1013,7 +1015,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
req->command != SOCKS_COMMAND_RESOLVE) {
/* not a connect or resolve? we don't support it. */
warn(LD_APP,"socks4: command %d not recognized. Rejecting.",
req->command);
req->command);
return -1;
}
......@@ -1029,7 +1031,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf));
if (strlen(tmpbuf)+1 > MAX_SOCKS_ADDR_LEN) {
debug(LD_APP,"socks4 addr (%d bytes) too long. Rejecting.",
(int)strlen(tmpbuf));
(int)strlen(tmpbuf));
return -1;
}
debug(LD_APP,"socks4: successfully read destip (%s)", safe_str(tmpbuf));
......@@ -1112,7 +1114,7 @@ fetch_from_buf_socks(buf_t *buf, socks_request_t *req, int log_sockstype)
/* fall through */
default: /* version is not socks4 or socks5 */
warn(LD_APP,"Socks version %d not recognized. (Tor is not an http proxy.)",
*(buf->cur));
*(buf->cur));
return -1;
}
}
......
......@@ -338,7 +338,7 @@ circuit_handle_first_hop(circuit_t *circ)
in.s_addr = htonl(firsthop->extend_info->addr);
tor_inet_ntoa(&in, tmpbuf, sizeof(tmpbuf));
debug(LD_CIRC,"Looking for firsthop '%s:%u'",tmpbuf,
firsthop->extend_info->port);
firsthop->extend_info->port);
/* imprint the circuit with its future n_conn->id */
memcpy(circ->n_conn_id_digest, firsthop->extend_info->identity_digest,
DIGEST_LEN);
......@@ -391,7 +391,7 @@ circuit_n_conn_done(connection_t *or_conn, int status)
extern smartlist_t *circuits_pending_or_conns;
debug(LD_CIRC,"or_conn to %s, status=%d",
or_conn->nickname ? or_conn->nickname : "NULL", status);
or_conn->nickname ? or_conn->nickname : "NULL", status);
if (!circuits_pending_or_conns)
return;
......@@ -656,7 +656,9 @@ circuit_extend(cell_t *cell, circuit_t *circ)
relay_header_unpack(&rh, cell->payload);
if (rh.length < 4+2+ONIONSKIN_CHALLENGE_LEN+DIGEST_LEN) {
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,"Wrong length %d on extend cell. Closing circuit.", rh.length);
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
"Wrong length %d on extend cell. Closing circuit.",
rh.length);
return -1;
}
......@@ -678,7 +680,7 @@ circuit_extend(cell_t *cell, circuit_t *circ)
in.s_addr = htonl(circ->n_addr);
tor_inet_ntoa(&in,tmpbuf,sizeof(tmpbuf));
info(LD_CIRC|LD_OR,"Next router (%s:%d) not connected. Connecting.",
tmpbuf, circ->n_port);
tmpbuf, circ->n_port);
circ->onionskin = tor_malloc(ONIONSKIN_CHALLENGE_LEN);
memcpy(circ->onionskin, onionskin, ONIONSKIN_CHALLENGE_LEN);
......@@ -910,7 +912,7 @@ onionskin_answer(circuit_t *circ, uint8_t cell_type, char *payload, char *keys)
cell_type == CELL_CREATED ? ONIONSKIN_REPLY_LEN : DIGEST_LEN*2);
debug(LD_CIRC,"init digest forward 0x%.8x, backward 0x%.8x.",
(unsigned int)*(uint32_t*)(keys), (unsigned int)*(uint32_t*)(keys+20));
(unsigned int)*(uint32_t*)(keys), (unsigned int)*(uint32_t*)(keys+20));
if (circuit_init_cpath_crypto(tmp_cpath, keys, 0)<0) {
warn(LD_BUG,"Circuit initialization failed");
tor_free(tmp_cpath);
......@@ -969,19 +971,19 @@ new_route_len(double cw, uint8_t purpose, extend_info_t *exit,
routelen++;
#endif
debug(LD_CIRC,"Chosen route length %d (%d routers available).",routelen,
smartlist_len(routers));
smartlist_len(routers));
num_acceptable_routers = count_acceptable_routers(routers);
if (num_acceptable_routers < 2) {
info(LD_CIRC,"Not enough acceptable routers (%d). Discarding this circuit.",
num_acceptable_routers);
num_acceptable_routers);
return -1;
}
if (num_acceptable_routers < routelen) {
info(LD_CIRC,"Not enough routers: cutting routelen from %d to %d.",
routelen, num_acceptable_routers);
routelen, num_acceptable_routers);
routelen = num_acceptable_routers;
}
......@@ -1184,7 +1186,7 @@ choose_good_exit_server_general(routerlist_t *dir, int need_uptime,
}
}
info(LD_CIRC, "Found %d servers that might support %d/%d pending connections.",
n_best_support, best_support, n_pending_connections);
n_best_support, best_support, n_pending_connections);
preferredexits = smartlist_create();
add_nickname_list_to_smartlist(preferredexits,options->ExitNodes,1,1);
......@@ -1216,8 +1218,8 @@ choose_good_exit_server_general(routerlist_t *dir, int need_uptime,
if (best_support == -1) {
if (need_uptime || need_capacity) {
info(LD_CIRC, "We couldn't find any live%s%s routers; falling back to list of all routers.",
need_capacity?", fast":"",
need_uptime?", stable":"");
need_capacity?", fast":"",
need_uptime?", stable":"");
return choose_good_exit_server_general(dir, 0, 0);
}
notice(LD_CIRC, "All routers are down or middleman -- choosing a doomed exit at random.");
......@@ -1358,7 +1360,7 @@ circuit_extend_to_new_exit(circuit_t *circ, extend_info_t *info)
circuit_set_state(circ, CIRCUIT_STATE_BUILDING);
if (circuit_send_next_onion_skin(circ)<0) {
warn(LD_CIRC, "Couldn't extend circuit to new point '%s'.",
info->nickname);
info->nickname);
circuit_mark_for_close(circ);
return -1;
}
......@@ -1540,12 +1542,12 @@ onion_extend_cpath(uint8_t purpose, crypt_path_t **head_ptr,
if (cur_len >= state->desired_path_len) {
debug(LD_CIRC, "Path is complete: %d steps long",
state->desired_path_len);
state->desired_path_len);
return 1;
}
debug(LD_CIRC, "Path is %d long; we want %d", cur_len,
state->desired_path_len);
state->desired_path_len);
if (cur_len == state->desired_path_len - 1) { /* Picking last node */
info = extend_info_dup(state->chosen_exit);
......@@ -1566,7 +1568,7 @@ onion_extend_cpath(uint8_t purpose, crypt_path_t **head_ptr,
}
debug(LD_CIRC,"Chose router %s for hop %d (exit is %s)",
info->nickname, cur_len+1, build_state_get_exit_nickname(state));
info->nickname, cur_len+1, build_state_get_exit_nickname(state));
onion_append_hop(head_ptr, info);
extend_info_free(info);
......@@ -1754,7 +1756,7 @@ remove_dead_helpers(void)
base16_encode(dbuf, sizeof(dbuf), helper->identity, DIGEST_LEN);
format_local_iso_time(tbuf, since);
warn(LD_CIRC, "Helper node '%s' (%s) has been %s since %s; removing.",
helper->nickname, dbuf, why, tbuf);
helper->nickname, dbuf, why, tbuf);
tor_free(helper);
smartlist_del(helper_nodes, i);
helper_nodes_changed();
......@@ -1796,13 +1798,13 @@ helper_nodes_set_status_from_directory(void)
helper->unlisted_since = time(NULL);
++changed;
warn(LD_CIRC,"Helper node '%s' is not listed by directories",
helper->nickname);
helper->nickname);
severity = LOG_WARN;
}
} else {
if (helper->unlisted_since) {
warn(LD_CIRC,"Helper node '%s' is listed again by directories",
helper->nickname);
helper->nickname);
++changed;
severity = LOG_WARN;
}
......@@ -1852,17 +1854,17 @@ helper_node_set_status(const char *digest, int succeeded)
if (helper->down_since) {
/*XXXX shouldn't warn. NM */
warn(LD_CIRC,
"Connection to formerly down helper node '%s' succeeded. "
"%d/%d helpers usable.", helper->nickname,
num_live_helpers(), smartlist_len(helper_nodes));
"Connection to formerly down helper node '%s' succeeded. "
"%d/%d helpers usable.", helper->nickname,
num_live_helpers(), smartlist_len(helper_nodes));
helper_nodes_changed();
}
helper->down_since = 0;
} else if (!helper->down_since) {
helper->down_since = time(NULL);
warn(LD_CIRC,
"Connection to helper node '%s' failed. %d/%d helpers usable.",
helper->nickname, num_live_helpers(), smartlist_len(helper_nodes));
"Connection to helper node '%s' failed. %d/%d helpers usable.",
helper->nickname, num_live_helpers(), smartlist_len(helper_nodes));
helper_nodes_changed();
}
}
......
......@@ -559,7 +559,8 @@ circuit_find_to_cannibalize(uint8_t purpose, extend_info_t *info,
circuit_t *circ;
circuit_t *best=NULL;
debug(LD_CIRC,"Hunting for a circ to cannibalize: purpose %d, uptime %d, capacity %d, internal %d", purpose, need_uptime, need_capacity, internal);
debug(LD_CIRC,"Hunting for a circ to cannibalize: purpose %d, uptime %d, capacity %d, internal %d",
purpose, need_uptime, need_capacity, internal);
for (circ=global_circuitlist; circ; circ = circ->next) {
if (CIRCUIT_IS_ORIGIN(circ) &&
......@@ -682,8 +683,8 @@ _circuit_mark_for_close(circuit_t *circ, int line, const char *file)
tor_assert(circ->build_state->chosen_exit);
/* treat this like getting a nack from it */
info(LD_REND,"Failed intro circ %s to %s (awaiting ack). Removing from descriptor.",
safe_str(circ->rend_query),
safe_str(build_state_get_exit_nickname(circ->build_state)));
safe_str(circ->rend_query),
safe_str(build_state_get_exit_nickname(circ->build_state)));
rend_client_remove_intro_point(circ->build_state->chosen_exit,
circ->rend_query);
}
......
......@@ -372,7 +372,7 @@ circuit_predict_and_launch_new(void)
if (!circuit_all_predicted_ports_handled(now, &port_needs_uptime,
&port_needs_capacity)) {
info(LD_CIRC,"Have %d clean circs (%d internal), need another exit circ.",
num, num_internal);
num, num_internal);
circuit_launch_by_router(CIRCUIT_PURPOSE_C_GENERAL, NULL,
port_needs_uptime, port_needs_capacity, 0);
return;
......@@ -381,7 +381,7 @@ circuit_predict_and_launch_new(void)
/* Third, see if we need any more hidden service (server) circuits. */
if (num_rend_services() && num_uptime_internal < 3) {
info(LD_CIRC,"Have %d clean circs (%d internal), need another internal circ for my hidden service.",
num, num_internal);
num, num_internal);
circuit_launch_by_router(CIRCUIT_PURPOSE_C_GENERAL, NULL,
1, 1, 1);
return;
......@@ -393,7 +393,7 @@ circuit_predict_and_launch_new(void)
((num_uptime_internal<2 && hidserv_needs_uptime) ||
num_internal<2)) {
info(LD_CIRC,"Have %d clean circs (%d uptime-internal, %d internal),"
" need another hidserv circ.", num, num_uptime_internal, num_internal);
" need another hidserv circ.", num, num_uptime_internal, num_internal);
circuit_launch_by_router(CIRCUIT_PURPOSE_C_GENERAL, NULL,
hidserv_needs_uptime, hidserv_needs_capacity, 1);
return;
......@@ -569,7 +569,7 @@ circuit_expire_old_circuits(void)
#define CIRCUIT_UNUSED_CIRC_TIMEOUT 3600 /* an hour */
if (circ->timestamp_created + CIRCUIT_UNUSED_CIRC_TIMEOUT < now) {
debug(LD_CIRC,"Closing circuit that has been unused for %d seconds.",
(int)(now - circ->timestamp_created));
(int)(now - circ->timestamp_created));
circuit_mark_for_close(circ);
}
}
......@@ -771,7 +771,7 @@ circuit_launch_by_extend_info(uint8_t purpose, extend_info_t *extend_info,
need_uptime, need_capacity, internal);
if (circ) {
info(LD_CIRC,"Cannibalizing circ '%s' for purpose %d",
build_state_get_exit_nickname(circ->build_state), purpose);
build_state_get_exit_nickname(circ->build_state), purpose);
circ->purpose = purpose;
/* reset the birth date of this circ, else expire_building
* will see it and think it's been trying to build since it
......@@ -1129,12 +1129,12 @@ connection_ap_handshake_attach_circuit(connection_t *conn)
routerinfo_t *router = router_get_by_nickname(conn->chosen_exit_name, 1);
if (!router) {
warn(LD_APP,"Requested exit point '%s' is not known. Closing.",
conn->chosen_exit_name);
conn->chosen_exit_name);
return -1;
}
if (!connection_ap_can_use_exit(conn, router)) {
warn(LD_APP, "Requested exit point '%s' would refuse request. Closing.",
conn->chosen_exit_name);
conn->chosen_exit_name);
return -1;
}
}
......@@ -1145,7 +1145,7 @@ connection_ap_handshake_attach_circuit(connection_t *conn)
return retval;
debug(LD_APP|LD_CIRC,"Attaching apconn to circ %d (stream %d sec old).",
circ->n_circ_id, conn_age);
circ->n_circ_id, conn_age);
/* here, print the circ's path. so people can figure out which circs are sucking. */
circuit_log_path(LOG_INFO,LD_APP|LD_CIRC,circ);
......@@ -1181,7 +1181,10 @@ connection_ap_handshake_attach_circuit(connection_t *conn)
}
if (rendcirc && rendcirc->purpose == CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED) {
info(LD_REND,"pending-join circ %d already here, with intro ack. Stalling. (stream %d sec old)", rendcirc->n_circ_id, conn_age);
info(LD_REND,
"pending-join circ %d already here, with intro ack. "
"Stalling. (stream %d sec old)",
rendcirc->n_circ_id, conn_age);
return 0;
}
......@@ -1202,12 +1205,12 @@ connection_ap_handshake_attach_circuit(connection_t *conn)
if (rendcirc && introcirc && rendcirc->purpose == CIRCUIT_PURPOSE_C_REND_READY) {
info(LD_REND,"ready rend circ %d already here (no intro-ack yet on intro %d). (stream %d sec old)",
rendcirc->n_circ_id, introcirc->n_circ_id, conn_age);
rendcirc->n_circ_id, introcirc->n_circ_id, conn_age);
tor_assert(introcirc->purpose == CIRCUIT_PURPOSE_C_INTRODUCING);
if (introcirc->state == CIRCUIT_STATE_OPEN) {
info(LD_REND,"found open intro circ %d (rend %d); sending introduction. (stream %d sec old)",
introcirc->n_circ_id, rendcirc->n_circ_id, conn_age);
introcirc->n_circ_id, rendcirc->n_circ_id, conn_age);
if (rend_client_send_introduction(introcirc, rendcirc) < 0) {
return -1;
}
......
......@@ -82,10 +82,10 @@ command_process_cell(cell_t *cell, connection_t *conn)
if (now > current_second) { /* the second has rolled over */
/* print stats */
info(LD_OR,"At end of second: %d creates (%d ms), %d createds (%d ms), %d relays (%d ms), %d destroys (%d ms)",
num_create, create_time/1000,
num_created, created_time/1000,
num_relay, relay_time/1000,
num_destroy, destroy_time/1000);
num_create, create_time/1000,
num_created, created_time/1000,
num_relay, relay_time/1000,
num_destroy, destroy_time/1000);
/* zero out stats */
num_create = num_created = num_relay = num_destroy = 0;
......@@ -174,11 +174,11 @@ command_process_create_cell(cell_t *cell, connection_t *conn)
*/
if ((cell->circ_id & (1<<15)) && conn->circ_id_type == CIRC_ID_TYPE_HIGHER) {
info(LD_OR, "Got a high circuit ID from %s (%d); switching to low circuit IDs.",
conn->nickname ? conn->nickname : "client", conn->s);
conn->nickname ? conn->nickname : "client", conn->s);
conn->circ_id_type = CIRC_ID_TYPE_LOWER;
} else if (!(cell->circ_id & (1<<15)) && conn->circ_id_type == CIRC_ID_TYPE_LOWER) {
info(LD_OR, "Got a low circuit ID from %s (%d); switching to high circuit IDs.",
conn->nickname ? conn->nickname : "client", conn->s);
conn->nickname ? conn->nickname : "client", conn->s);
conn->circ_id_type = CIRC_ID_TYPE_HIGHER;
}
......@@ -336,7 +336,7 @@ command_process_destroy_cell(cell_t *cell, connection_t *conn)
if (!circ) {
info(LD_OR,"unknown circuit %d on connection from %s:%d. Dropping.",
cell->circ_id, conn->address, conn->port);
cell->circ_id, conn->address, conn->port);
return;
}
debug(LD_OR,"Received for circID %d.",cell->circ_id);
......
......@@ -486,7 +486,7 @@ options_act_reversible(or_options_t *old_options)
/* Ensure data directory is private; create if possible. */
if (check_private_dir(options->DataDirectory, CPD_CREATE)<0) {
err(LD_FS, "Couldn't access/create private data directory \"%s\"",
options->DataDirectory);
options->DataDirectory);
/* No need to roll back, since you can't change the value. */
goto done;
}
......@@ -705,9 +705,9 @@ expand_abbrev(config_format_t *fmt, const char *option, int command_line,
(command_line || !fmt->abbrevs[i].commandline_only)) {
if (warn_obsolete && fmt->abbrevs[i].warn) {
warn(LD_CONFIG,
"The configuration option '%s' is deprecated; use '%s' instead.",
fmt->abbrevs[i].abbreviated,
fmt->abbrevs[i].full);
"The configuration option '%s' is deprecated; use '%s' instead.",
fmt->abbrevs[i].abbreviated,
fmt->abbrevs[i].full);
}
return fmt->abbrevs[i].full;
}
......@@ -740,7 +740,7 @@ config_get_commandlines(int argc, char **argv, config_line_t **result)
}
if (i == argc-1) {
warn(LD_CONFIG,"Command-line option '%s' with no value. Failing.",
argv[i]);
argv[i]);
config_free_lines(front);
return -1;
}
......@@ -867,8 +867,8 @@ config_find_option(config_format_t *fmt, const char *key)
for (i=0; fmt->vars[i].name; ++i) {
if (!strncasecmp(key, fmt->vars[i].name, keylen)) {
warn(LD_CONFIG, "The abbreviation '%s' is deprecated. "
"Please use '%s' instead",
key, fmt->vars[i].name);
"Please use '%s' instead",
key, fmt->vars[i].name);
return &fmt->vars[i];
}
}
......@@ -1099,7 +1099,7 @@ get_assigned_option(config_format_t *fmt, or_options_t *options, const char *key
return NULL;
} else if (var->type == CONFIG_TYPE_LINELIST_S) {
warn(LD_CONFIG,
"Can't return context-sensitive '%s' on its own", key);
"Can't return context-sensitive '%s' on its own", key);
return NULL;
}
value = ((char*)options) + var->var_offset;
......@@ -2524,7 +2524,7 @@ parse_log_severity_range(const char *range, int *min_out, int *max_out)
levelMin = parse_log_level(tmp_sev);
if (levelMin < 0) {
warn(LD_CONFIG, "Unrecognized log severity '%s': must be one of "
"err|warn|notice|info|debug", tmp_sev);
"err|warn|notice|info|debug", tmp_sev);
tor_free(tmp_sev);
return -1;
}
......@@ -2536,7 +2536,7 @@ parse_log_severity_range(const char *range, int *min_out, int *max_out)
levelMax = parse_log_level(cp+1);
if (levelMax < 0) {
warn(LD_CONFIG, "Unrecognized log severity '%s': must be one of "
"err|warn|notice|info|debug", cp+1);
"err|warn|notice|info|debug", cp+1);
return -1;
}
}
......@@ -2544,7 +2544,7 @@ parse_log_severity_range(const char *range, int *min_out, int *max_out)
levelMin = parse_log_level(range);
if (levelMin < 0) {
warn(LD_CONFIG, "Unrecognized log severity '%s': must be one of "
"err|warn|notice|info|debug", range);
"err|warn|notice|info|debug", range);
return -1;
}
levelMax = LOG_ERR;
......@@ -2581,7 +2581,7 @@ convert_log_option(or_options_t *options, config_line_t *level_opt,
if (file_opt && !strcasecmp(file_opt->key, "LogFile")) {
if (add_single_log_option(options, levelMin, levelMax, "file", file_opt->value) < 0) {
warn(LD_FS, "Cannot write to LogFile \"%s\": %s.", file_opt->value,
strerror(errno));
strerror(errno));
return -1;
}
} else if (file_opt && !strcasecmp(file_opt->key, "SysLog")) {
......@@ -2653,11 +2653,11 @@ options_init_logs(or_options_t *options, int validate_only)
#endif
} else {
warn(LD_CONFIG, "Unrecognized log type %s",
(const char*)smartlist_get(elts,1));
(const char*)smartlist_get(elts,1));
if (strchr(smartlist_get(elts,1), '/') ||
strchr(smartlist_get(elts,1), '\\')) {
warn(LD_CONFIG, "Did you mean to say 'Log file %s' ?",
(const char *)smartlist_get(elts,1));
(const char *)smartlist_get(elts,1));
}
ok = 0; goto cleanup;
}
......@@ -3397,7 +3397,7 @@ check_libevent_version(const char *m, const char *v, int server)
} else if (slow && server) {
log(LOG_WARN, LD_GENERAL,
"libevent %s can be very slow with %s. "
"When running a server, please use the latest version of libevent.",v,m);
"When running a server, please use the latest version of libevent.",v,m);
}
}
......
......@@ -322,7 +322,9 @@ connection_about_to_close_connection(connection_t *conn)
if (CONN_IS_EDGE(conn)) {
if (!conn->has_sent_end) {
warn(LD_BUG,"Harmless bug: Edge connection (marked at %s:%d) hasn't sent end yet?", conn->marked_for_close_file, conn->marked_for_close);
warn(LD_BUG,
"Harmless bug: Edge connection (marked at %s:%d) hasn't sent end yet?",
conn->marked_for_close_file, conn->marked_for_close);
tor_fragile_assert();
}
}
......@@ -367,7 +369,7 @@ connection_about_to_close_connection(connection_t *conn)
/* since conn gets removed right after this function finishes,
* there's no point trying to send back a reply at this point. */
warn(LD_BUG,"Bug: Closing stream (marked at %s:%d) without sending back a socks reply.",
conn->marked_for_close_file, conn->marked_for_close);
conn->marked_for_close_file, conn->marked_for_close);
} else {
control_event_stream_status(conn, STREAM_EVENT_CLOSED);
}
......@@ -403,9 +405,9 @@ connection_close_immediate(connection_t *conn)
}
if (conn->outbuf_flushlen) {
info(LD_NET,"fd %d, type %s, state %s, %d bytes on outbuf.",
conn->s, conn_type_to_string(conn->type),
conn_state_to_string(conn->type, conn->state),
(int)conn->outbuf_flushlen);
conn->s, conn_type_to_string(conn->type),
conn_state_to_string(conn->type, conn->state),
(int)conn->outbuf_flushlen);
}
connection_unregister(conn);
......@@ -540,13 +542,13 @@ connection_create_listener(const char *listenaddress, uint16_t listenport,
if (bind(s,(struct sockaddr *)&listenaddr,sizeof(listenaddr)) < 0) {
warn(LD_NET, "Could not bind to %s:%u: %s", address, usePort,
tor_socket_strerror(tor_socket_errno(s)));
tor_socket_strerror(tor_socket_errno(s)));
goto err;
}