From b17e8882559bf792315d36530cebd1fbc5c66207 Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Sat, 9 Sep 2017 12:58:12 +0200 Subject: [PATCH] lib-http: client: queue: Improved construction of timeout log message. Earlier change used a literal prefix size, rather than inferring the size from the actual prefix string. --- src/lib-http/http-client-queue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib-http/http-client-queue.c b/src/lib-http/http-client-queue.c index acea744448..ebd7c8398e 100644 --- a/src/lib-http/http-client-queue.c +++ b/src/lib-http/http-client-queue.c @@ -705,6 +705,7 @@ http_client_queue_request_timeout(struct http_client_queue *queue) ARRAY_TYPE(http_client_request) failed_requests; struct timeval new_to = { 0, 0 }; string_t *str; + size_t prefix_size; unsigned int count, i; http_client_queue_debug(queue, "Timeout (now: %s.%03lu)", @@ -733,6 +734,7 @@ http_client_queue_request_timeout(struct http_client_queue *queue) str = t_str_new(64); str_append(str, "Request "); + prefix_size = str_len(str); /* abort all failed request */ reqs = array_get(&failed_requests, &count); @@ -740,7 +742,7 @@ http_client_queue_request_timeout(struct http_client_queue *queue) for (i = 0; i < count; i++) { struct http_client_request *req = reqs[i]; - str_truncate(str, 8); + str_truncate(str, prefix_size); http_client_request_append_stats_text(req, str); http_client_queue_debug(queue, -- 2.47.3