From 1d56fe2bf4e2e16f90150f734ae0755c85e10236 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Tue, 7 May 2013 19:01:25 +0400 Subject: [PATCH] files-reg: Use read_fd_link helper Signed-off-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- files-reg.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/files-reg.c b/files-reg.c index 9faecdac8..684cfd3cc 100644 --- a/files-reg.c +++ b/files-reg.c @@ -432,20 +432,17 @@ static int check_path_remap(char *rpath, int plen, const struct stat *ost, int l int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p) { - char fd_str[128]; char rpath[PATH_MAX + 1] = ".", *path = rpath + 1; int len, rfd; RegFileEntry rfe = REG_FILE_ENTRY__INIT; - snprintf(fd_str, sizeof(fd_str), "/proc/self/fd/%d", lfd); - len = readlink(fd_str, path, sizeof(rpath) - 2); + len = read_fd_link(lfd, path, sizeof(rpath) - 1); if (len < 0) { - pr_perror("Can't readlink %s", fd_str); + pr_err("Can't read link\n"); return len; } - path[len] = '\0'; pr_info("Dumping path for %d fd via self %d [%s]\n", p->fd, lfd, path);