[CRIU] [PATCH 1/3] fsnotify: Add debug printing of the target link

Pavel Emelyanov xemul at parallels.com
Thu Oct 10 12:03:59 PDT 2013


On 10/10/2013 10:08 PM, Cyrill Gorcunov wrote:
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  fsnotify.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 


> @@ -213,8 +214,15 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
>  		path = remap->path;
>  	}
>  
> -	pr_debug("\t\tRestore %s watch for 0x%08x:0x%016lx (via %s)\n",
> -		 who, s_dev, i_ino, path);
> +	if (log_get_loglevel() >= LOG_DEBUG) {
> +		memzero(link, sizeof(link));
> +		readlink(path, link, sizeof(link));
> +		link[sizeof(link) - 1] = '\0';
> +	} else
> +		link[0] = '\0';
> +
> +	pr_debug("\t\tRestore %s watch for 0x%08x:0x%016lx (via %s -> %s)\n",
> +		 who, s_dev, i_ino, path, link);

Better make it like

pr_debug("\t\tRestore ...");
if (log_get_loglevel() >= LOG_REBUG) {
	char link[];
	readlink(...);
	pr_debug("\t\t -> %s", link);
}

>  
>  err:
>  	close_safe(&mntfd);


More information about the CRIU mailing list