mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-03 15:55:53 +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:
committed by
Pavel Emelyanov
parent
e2e4fb1218
commit
9cdb9102fa
@@ -541,7 +541,7 @@ static char *image_name(int fd)
|
|||||||
{
|
{
|
||||||
static char image_path[PATH_MAX];
|
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 image_path;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
4
util.c
4
util.c
@@ -436,14 +436,14 @@ int read_fd_link(int lfd, char *buf, size_t size)
|
|||||||
}
|
}
|
||||||
buf[ret] = 0;
|
buf[ret] = 0;
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_anon_link_type(int lfd, char *type)
|
int is_anon_link_type(int lfd, char *type)
|
||||||
{
|
{
|
||||||
char link[32], aux[32];
|
char link[32], aux[32];
|
||||||
|
|
||||||
if (read_fd_link(lfd, link, sizeof(link)))
|
if (read_fd_link(lfd, link, sizeof(link)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
snprintf(aux, sizeof(aux), "anon_inode:%s", type);
|
snprintf(aux, sizeof(aux), "anon_inode:%s", type);
|
||||||
|
Reference in New Issue
Block a user