diff --git a/protobuf.c b/protobuf.c index 3470efbfe..66b9d22bc 100644 --- a/protobuf.c +++ b/protobuf.c @@ -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; } diff --git a/util.c b/util.c index e36ab7e75..3052d00e9 100644 --- a/util.c +++ b/util.c @@ -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);