[CRIU] [PATCH 1/2] log: Don't override -v0 with -v2

Andrew Vagin avagin at parallels.com
Tue Feb 4 06:52:55 PST 2014


Acked-by: Andrew Vagin <avagin at parallels.com>

On Tue, Feb 04, 2014 at 06:03:07PM +0400, Pavel Emelyanov wrote:
> If we specify log level to none (0) the result is LOG_INFO (2).
> 
> Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
> ---
>  crtools.c          | 4 +++-
>  include/criu-log.h | 1 +
>  log.c              | 2 +-
>  3 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/crtools.c b/crtools.c
> index 2e60873..cff4a8f 100644
> --- a/crtools.c
> +++ b/crtools.c
> @@ -81,7 +81,7 @@ int main(int argc, char *argv[])
>  	int ret = -1;
>  	bool usage_error = true;
>  	int opt, idx;
> -	int log_level = 0;
> +	int log_level = LOG_UNSET;
>  	char *imgs_dir = ".";
>  	char *work_dir = NULL;
>  	static const char short_opts[] = "dsRf:F:t:p:hcD:o:n:v::xVr:jlW:L:";
> @@ -192,6 +192,8 @@ int main(int argc, char *argv[])
>  				goto bad_arg;
>  			break;
>  		case 'v':
> +			if (log_level == LOG_UNSET)
> +				log_level = 0;
>  			if (optarg) {
>  				if (optarg[0] == 'v')
>  					/* handle -vvvvv */
> diff --git a/include/criu-log.h b/include/criu-log.h
> index 613f70f..d84b315 100644
> --- a/include/criu-log.h
> +++ b/include/criu-log.h
> @@ -20,6 +20,7 @@
>  #ifndef __CRIU_LOG_H__
>  #define __CRIU_LOG_H__
>  
> +#define LOG_UNSET	(-1)
>  #define LOG_MSG		(0) /* Print message regardless of log level */
>  #define LOG_ERROR	(1) /* Errors only, when we're in trouble */
>  #define LOG_WARN	(2) /* Warnings, dazen and confused but trying to continue */
> diff --git a/log.c b/log.c
> index 277a9e8..c5ad472 100644
> --- a/log.c
> +++ b/log.c
> @@ -135,7 +135,7 @@ void log_fini(void)
>  
>  void log_set_loglevel(unsigned int level)
>  {
> -	if (!level)
> +	if (level == LOG_UNSET)
>  		current_loglevel = DEFAULT_LOGLEVEL;
>  	else
>  		current_loglevel = level;
> -- 
> 1.8.4.2
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list