Commit 9cdb9102 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

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

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent e2e4fb12
...@@ -541,7 +541,7 @@ static char *image_name(int fd) ...@@ -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;
} }
......
...@@ -436,14 +436,14 @@ int read_fd_link(int lfd, char *buf, size_t size) ...@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment