]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cli: create cli_raw_rcv_buf() from the generic applet_raw_rcv_buf()
authorWilly Tarreau <w@1wt.eu>
Mon, 27 Oct 2025 14:48:04 +0000 (15:48 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 27 Oct 2025 15:57:07 +0000 (16:57 +0100)
This is in preparation for a future fix. For now it's simply a pure
copy of the original function, but dedicated to the CLI. It will
have to be backported to 3.0.

src/cli.c

index fcb995a01ac82fb73741e7176474c62ddc25b9ae..059e343d7aa753ae03ccdaaba1690b4c8a1742d6 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -3902,12 +3902,17 @@ error:
        return -1;
 }
 
+size_t cli_raw_rcv_buf(struct appctx *appctx, struct buffer *buf, size_t count, unsigned int flags)
+{
+       return b_xfer(buf, &appctx->outbuf, MIN(count, b_data(&appctx->outbuf)));
+}
+
 static struct applet cli_applet = {
        .obj_type = OBJ_TYPE_APPLET,
        .flags = APPLET_FL_NEW_API,
        .name = "<CLI>", /* used for logging */
        .fct = cli_io_handler,
-       .rcv_buf = appctx_raw_rcv_buf,
+       .rcv_buf = cli_raw_rcv_buf,
        .snd_buf = appctx_raw_snd_buf,
        .release = cli_release_handler,
 };
@@ -3918,7 +3923,7 @@ static struct applet mcli_applet = {
        .flags = APPLET_FL_NEW_API,
        .name = "<MCLI>", /* used for logging */
        .fct = cli_io_handler,
-       .rcv_buf = appctx_raw_rcv_buf,
+       .rcv_buf = cli_raw_rcv_buf,
        .snd_buf = appctx_raw_snd_buf,
        .release = cli_release_handler,
 };