[CRIU] [PATCH 1/2] service: ban subdirs in logfile name

Pavel Emelyanov xemul at parallels.com
Tue Feb 4 06:22:13 PST 2014


On 02/04/2014 12:51 PM, Ruslan Kuprieiev wrote:
> Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
> ---
>  cr-service.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/cr-service.c b/cr-service.c
> index ff2fb0d..5ef5d52 100644
> --- a/cr-service.c
> +++ b/cr-service.c
> @@ -189,9 +189,14 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
>  	}
>  
>  	/* initiate log file in work dir */
> -	if (req->log_file)
> +	if (req->log_file) {
> +		if (strchr(req->log_file, '.') || strchr(req->log_file, '/')) {

Why can't I specify log_file = "dump.log"? Why dots are not allowed?

> +			pr_perror("No subdirs are allowed in log_file name");
> +			return -1;
> +		}
> +
>  		opts.output = req->log_file;
> -	else
> +	} else
>  		opts.output = DEFAULT_LOG_FILENAME;
>  
>  	log_set_loglevel(req->log_level);
> 




More information about the CRIU mailing list