RPC: fix wrong log_level handling

Submitted by Adrian Reber on Sept. 6, 2018, 9:27 a.m.

Details

Message ID 20180906092743.15728-1-adrian@lisas.de
State Accepted
Series "RPC: fix wrong log_level handling"
Headers show

Commit Message

Adrian Reber Sept. 6, 2018, 9:27 a.m.
From: Adrian Reber <areber@redhat.com>

In RPC mode the log_level was always reset to the default log level of 2, if no
configuration file was used.

This saves the log level set via RPC in opts.log_level and a configuration file
can overwrite it later, but if it is only set via RPC this value is not ignored
now.

Signed-off-by: Adrian Reber <areber@redhat.com>
---
 criu/cr-service.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/cr-service.c b/criu/cr-service.c
index 643aba9cf..d7f12b9c0 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -363,6 +363,8 @@  static int setup_opts_from_req(int sk, CriuOpts *req)
 		SET_CHAR_OPTS(output, DEFAULT_LOG_FILENAME);
 	}
 
+	/* This is needed later to correctly set the log_level */
+	opts.log_level = req->log_level;
 	log_set_loglevel(req->log_level);
 	if (log_init(opts.output) == -1) {
 		pr_perror("Can't initiate log");

Comments

Andrey Vagin Sept. 10, 2018, 7:27 p.m.
Applied, thanks!

On Thu, Sep 06, 2018 at 11:27:43AM +0200, Adrian Reber wrote:
> From: Adrian Reber <areber@redhat.com>
> 
> In RPC mode the log_level was always reset to the default log level of 2, if no
> configuration file was used.
> 
> This saves the log level set via RPC in opts.log_level and a configuration file
> can overwrite it later, but if it is only set via RPC this value is not ignored
> now.
> 
> Signed-off-by: Adrian Reber <areber@redhat.com>
> ---
>  criu/cr-service.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/criu/cr-service.c b/criu/cr-service.c
> index 643aba9cf..d7f12b9c0 100644
> --- a/criu/cr-service.c
> +++ b/criu/cr-service.c
> @@ -363,6 +363,8 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
>  		SET_CHAR_OPTS(output, DEFAULT_LOG_FILENAME);
>  	}
>  
> +	/* This is needed later to correctly set the log_level */
> +	opts.log_level = req->log_level;
>  	log_set_loglevel(req->log_level);
>  	if (log_init(opts.output) == -1) {
>  		pr_perror("Can't initiate log");
> -- 
> 2.17.1
>