[CRIU] [PATCH 1/3] fsnotify: Add debug printing of the target link
Andrew Vagin
avagin at parallels.com
Sat Oct 12 09:45:11 PDT 2013
On Thu, Oct 10, 2013 at 10:08:22PM +0400, Cyrill Gorcunov wrote:
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> fsnotify.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/fsnotify.c b/fsnotify.c
> index 15a733e..32695d6 100644
> --- a/fsnotify.c
> +++ b/fsnotify.c
> @@ -180,6 +180,7 @@ static char *get_mark_path(const char *who, struct file_remap *remap,
> unsigned int s_dev, char *buf, size_t size,
> int *target)
> {
> + char link[PATH_MAX];
> char *path = NULL;
> int mntfd = -1;
> fh_t handle;
> @@ -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';
This is wrong.
ret = readlink(path, link, sizeof(link) - 1);
link[ret= = '\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);
>
> err:
> close_safe(&mntfd);
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list