summaryrefslogtreecommitdiffstats
path: root/src/libserver/worker_util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-10-15 13:35:09 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-10-15 13:35:09 +0100
commitd6ba63371f1558539c9b0fab1640f80dae699bae (patch)
tree2827a9c842b0404fa701b6f88bc084951261593f /src/libserver/worker_util.c
parent9710cbb0853e4a0841e542e90c29e6e556aeed04 (diff)
downloadrspamd-d6ba63371f1558539c9b0fab1640f80dae699bae.tar.gz
rspamd-d6ba63371f1558539c9b0fab1640f80dae699bae.zip
Send controller reply now accepts variadic args.
Diffstat (limited to 'src/libserver/worker_util.c')
-rw-r--r--src/libserver/worker_util.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index 20ef1fc15..5abf77cf2 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -189,17 +189,22 @@ rspamd_worker_stop_accept (struct rspamd_worker *worker)
void
rspamd_controller_send_error (struct rspamd_http_connection_entry *entry,
- gint code,
- const gchar *error_msg)
+ gint code, const gchar *error_msg, ...)
{
struct rspamd_http_message *msg;
+ va_list args;
msg = rspamd_http_new_message (HTTP_RESPONSE);
+
+ va_start (args, error_msg);
+ msg->status = g_string_sized_new (128);
+ rspamd_vprintf_gstring (msg->status, error_msg, args);
+ va_end (args);
+
msg->date = time (NULL);
msg->code = code;
msg->body = g_string_sized_new (128);
- msg->status = g_string_new (error_msg);
- rspamd_printf_gstring (msg->body, "{\"error\":\"%s\"}", error_msg);
+ rspamd_printf_gstring (msg->body, "{\"error\":\"%v\"}", msg->status);
rspamd_http_connection_reset (entry->conn);
rspamd_http_connection_write_message (entry->conn,
msg,