diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-05-30 19:57:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-05-30 23:59:49 -0400 |
commit | 3a9351b57e528b1d0bd2e72bcf78db7c91b2ff8f (patch) | |
tree | d52e3eb45e5ed0b32d9ae3af06daf9646c1a05e3 /src/or/control.c | |
parent | e28489467233bff4500a70f8a7b22e42ca3b3e68 (diff) | |
download | tor-3a9351b57e528b1d0bd2e72bcf78db7c91b2ff8f.tar.gz tor-3a9351b57e528b1d0bd2e72bcf78db7c91b2ff8f.zip |
Fix more clang format-nonliteral warnings (bug 5969)
Diffstat (limited to 'src/or/control.c')
-rw-r--r-- | src/or/control.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/or/control.c b/src/or/control.c index d6e693285c..8aa4240f12 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -126,6 +126,13 @@ typedef int event_format_t; static void connection_printf_to_buf(control_connection_t *conn, const char *format, ...) CHECK_PRINTF(2,3); +static void send_control_event_impl(uint16_t event, event_format_t which, + const char *format, va_list ap) + CHECK_PRINTF(3,0); +static int control_event_status(int type, int severity, const char *format, + va_list args) + CHECK_PRINTF(3,0); + static void send_control_done(control_connection_t *conn); static void send_control_event(uint16_t event, event_format_t which, const char *format, ...) @@ -3918,6 +3925,7 @@ control_event_my_descriptor_changed(void) static int control_event_status(int type, int severity, const char *format, va_list args) { + char *user_buf = NULL; char format_buf[160]; const char *status, *sev; @@ -3949,13 +3957,15 @@ control_event_status(int type, int severity, const char *format, va_list args) log_warn(LD_BUG, "Unrecognized status severity %d", severity); return -1; } - if (tor_snprintf(format_buf, sizeof(format_buf), "650 %s %s %s\r\n", - status, sev, format)<0) { + if (tor_snprintf(format_buf, sizeof(format_buf), "650 %s %s\r\n", + status, sev)<0) { log_warn(LD_BUG, "Format string too long."); return -1; } + tor_vasprintf(&user_buf, format, args); - send_control_event_impl(type, ALL_FORMATS, format_buf, args); + send_control_event(type, ALL_FORMATS, "%s %s", format_buf, user_buf); + tor_free(user_buf); return 0; } |