[CRIU] [PATCH] fsnotify: Print error if link can't be read

Pavel Emelyanov xemul at parallels.com
Mon Oct 14 02:22:35 PDT 2013


On 10/11/2013 07:21 PM, Cyrill Gorcunov wrote:
> On some machine, where fsnotify failed to restore
> due to different reason, readlink fails as well, so
> print
> 
> | (01.115708)    244: Error (fsnotify.c:220): fsnotify: Can't read link for /proc/self/fd/7: Permission denied
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  fsnotify.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/fsnotify.c b/fsnotify.c
> index e0f59b9..784c416 100644
> --- a/fsnotify.c
> +++ b/fsnotify.c
> @@ -216,8 +216,11 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
>  
>  	if (log_get_loglevel() >= LOG_DEBUG) {
>  		memzero(link, sizeof(link));
> -		readlink(path, link, sizeof(link));
> -		link[sizeof(link) - 1] = '\0';
> +		if (readlink(path, link, sizeof(link)) < 0) {
> +			pr_perror("Can't read link for %s", path);
> +			link[0] = '\0';
> +		} else
> +			link[sizeof(link) - 1] = '\0';
>  	} else
>  		link[0] = '\0';
>  
> 


Can you combine the two and resend?


More information about the CRIU mailing list