Fix/annotate deadcode for CID 402,403

This commit is contained in:
Nick Mathewson 2009-10-26 22:35:29 -04:00
parent 134ac8059b
commit 385853a282
2 changed files with 25 additions and 22 deletions

View File

@ -830,36 +830,36 @@ handle_control_loadconf(control_connection_t *conn, uint32_t len,
retval = options_init_from_string(body, CMD_RUN_TOR, NULL, &errstring); retval = options_init_from_string(body, CMD_RUN_TOR, NULL, &errstring);
if (retval != SETOPT_OK) { if (retval != SETOPT_OK)
log_warn(LD_CONTROL, log_warn(LD_CONTROL,
"Controller gave us config file that didn't validate: %s", "Controller gave us config file that didn't validate: %s",
errstring); errstring);
switch (retval) {
case SETOPT_ERR_PARSE: switch (retval) {
msg = "552 Invalid config file"; case SETOPT_ERR_PARSE:
break; msg = "552 Invalid config file";
case SETOPT_ERR_TRANSITION: break;
msg = "553 Transition not allowed"; case SETOPT_ERR_TRANSITION:
break; msg = "553 Transition not allowed";
case SETOPT_ERR_SETTING: break;
msg = "553 Unable to set option"; case SETOPT_ERR_SETTING:
break; msg = "553 Unable to set option";
case SETOPT_ERR_MISC: break;
default: case SETOPT_ERR_MISC:
msg = "550 Unable to load config"; default:
break; msg = "550 Unable to load config";
case SETOPT_OK: break;
tor_fragile_assert(); case SETOPT_OK:
break; break;
} }
if (msg) {
if (*errstring) if (*errstring)
connection_printf_to_buf(conn, "%s: %s\r\n", msg, errstring); connection_printf_to_buf(conn, "%s: %s\r\n", msg, errstring);
else else
connection_printf_to_buf(conn, "%s\r\n", msg); connection_printf_to_buf(conn, "%s\r\n", msg);
tor_free(errstring); } else {
return 0; send_control_done(conn);
} }
send_control_done(conn);
return 0; return 0;
} }

View File

@ -182,6 +182,9 @@ accounting_parse_options(or_options_t *options, int validate_only)
case UNIT_DAY: case UNIT_DAY:
d = 0; d = 0;
break; break;
/* Coverity dislikes unreachable default cases; some compilers warn on
* switch statements missing a case. Tell Coverity not to worry. */
/* coverity[dead_error_begin] */
default: default:
tor_assert(0); tor_assert(0);
} }