BUG/MINOR: proxy: fix dump_server_state()'s misuse of the trash
dump_server_state() claims to dump into a buffer but instead it writes
into a buffer then dumps the trash into the channel, so it only supports
being called with buf=&trash and doesn't need this buffer. There doesn't
seem to be any current impact of this mistake since the function is called
from one location only.
A backport may be performed if it helps fixing other bugs but it will not
fix an existing bug by itself.
(cherry picked from commit 6ff8143f7c87ad40d7369119467d779642702ad5)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 00b4b530a2f505667e65c556aeacc6a9c1267700)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/proxy.c b/src/proxy.c
index 854db6c..0d8c7b1 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -1802,14 +1802,14 @@
return 0;
}
-/* dumps server state information into <buf> for all the servers found in backend cli.p0.
+/* dumps server state information for all the servers found in backend cli.p0.
* These information are all the parameters which may change during HAProxy runtime.
* By default, we only export to the last known server state file format.
* These information can be used at next startup to recover same level of server state.
* It uses the proxy pointer from cli.p0, the proxy's id from cli.i0 and the server's
* pointer from cli.p1.
*/
-static int dump_servers_state(struct stream_interface *si, struct buffer *buf)
+static int dump_servers_state(struct stream_interface *si)
{
struct appctx *appctx = __objt_appctx(si->end);
struct proxy *px = appctx->ctx.cli.p0;
@@ -1851,7 +1851,7 @@
if (srv->srvrq && srv->srvrq->name)
srvrecord = srv->srvrq->name;
- chunk_appendf(buf,
+ chunk_appendf(&trash,
"%d %s "
"%d %s %s "
"%d %d %d %d %ld "
@@ -1903,7 +1903,7 @@
curproxy = appctx->ctx.cli.p0;
/* servers are only in backends */
if (curproxy->cap & PR_CAP_BE) {
- if (!dump_servers_state(si, &trash))
+ if (!dump_servers_state(si))
return 0;
}
/* only the selected proxy is dumped */