From: Christian Brauner Date: Wed, 15 Nov 2017 15:04:12 +0000 (+0100) Subject: commands: only set ringbuffer datalen when needed X-Git-Tag: lxc-3.0.0.beta1~182^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5928191e83fdb99e45b830f0a7b95bd99eca1d4f;p=thirdparty%2Flxc.git commands: only set ringbuffer datalen when needed If we do it unconditionally a request to only clear the ringbuffer and not read or write anything will fail. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/commands.c b/src/lxc/commands.c index c158672ed..759346b8b 100644 --- a/src/lxc/commands.c +++ b/src/lxc/commands.c @@ -1037,7 +1037,9 @@ static int lxc_cmd_console_log_callback(int fd, struct lxc_cmd_req *req, if (buffer_size <= 0) goto out; - rsp.datalen = lxc_ringbuf_used(buf); + if (log->read || log->write_logfile) + rsp.datalen = lxc_ringbuf_used(buf); + if (log->read) rsp.data = lxc_ringbuf_get_read_addr(buf);