2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

util: Make read_fd_link to return the length of the link read

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov
2013-05-07 19:01:24 +04:00
committed by Pavel Emelyanov
parent e2e4fb1218
commit 9cdb9102fa
2 changed files with 3 additions and 3 deletions

View File

@@ -541,7 +541,7 @@ static char *image_name(int fd)
{
static char image_path[PATH_MAX];
if (read_fd_link(fd, image_path, sizeof(image_path)) == 0)
if (read_fd_link(fd, image_path, sizeof(image_path)) > 0)
return image_path;
return NULL;
}

4
util.c
View File

@@ -436,14 +436,14 @@ int read_fd_link(int lfd, char *buf, size_t size)
}
buf[ret] = 0;
return 0;
return ret;
}
int is_anon_link_type(int lfd, char *type)
{
char link[32], aux[32];
if (read_fd_link(lfd, link, sizeof(link)))
if (read_fd_link(lfd, link, sizeof(link)) < 0)
return -1;
snprintf(aux, sizeof(aux), "anon_inode:%s", type);