[CRIU] [PATCH] sk-unix.c: Don't mangle name provided by diag message if no mount point present

Cyrill Gorcunov gorcunov at openvz.org
Thu Aug 30 10:15:45 EDT 2012


Otherwise we can't fetch stat.

Reported-by: "Muralidhar, Rajeev D" <rajeev.d.muralidhar at intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 sk-unix.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/sk-unix.c b/sk-unix.c
index 9a9323c..5758f69 100644
--- a/sk-unix.c
+++ b/sk-unix.c
@@ -277,7 +277,10 @@ static int unix_collect_one(const struct unix_diag_msg *m,
 			}
 
 			uv = RTA_DATA(tb[UNIX_DIAG_VFS]);
-			snprintf(rpath, sizeof(rpath), ".%s", name);
+			if (mntns_root >= 0)
+				snprintf(rpath, sizeof(rpath), ".%s", name);
+			else
+				snprintf(rpath, sizeof(rpath), "%s", name);
 			if (fstatat(mntns_root, rpath, &st, 0)) {
 				pr_perror("Can't stat socket %d(%s)",
 						m->udiag_ino, rpath);
-- 
1.7.7.6



More information about the CRIU mailing list