]> source.dussan.org Git - rspamd.git/commitdiff
Send controller reply now accepts variadic args.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 15 Oct 2014 12:35:09 +0000 (13:35 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 15 Oct 2014 12:35:09 +0000 (13:35 +0100)
src/libserver/worker_util.c
src/libserver/worker_util.h

index 20ef1fc15dbacd78463be3c9d644a3f4ea73240c..5abf77cf2c61516528c345c694831679ec1e11d2 100644 (file)
@@ -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,
index d1aa1e862daf37a1d75bc17ca39a9d526d3b9e62..f8cbccfa5b215a43bdb1c03148aca577d0cfc054 100644 (file)
@@ -80,8 +80,7 @@ struct rspamd_custom_controller_command {
  * @param error_msg error message
  */
 void rspamd_controller_send_error (struct rspamd_http_connection_entry *entry,
-       gint code,
-       const gchar *error_msg);
+       gint code, const gchar *error_msg, ...);
 
 /**
  * Send a custom string using HTTP