[CRIU] [PATCH] files: Tune up false perror message

Pavel Emelyanov xemul at virtuozzo.com
Tue Aug 23 12:51:09 PDT 2016


When linkat fails in uns we print error (!) and then sometimes
try some other way to linkat anyway %). Fix this place not
to produce the error message all the time, but only when it's
needed.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>

---

diff --git a/criu/files-reg.c b/criu/files-reg.c
index 03ad363..b91a2c3 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -1195,10 +1195,15 @@ static int linkat_hard(int odir, char *opath, int ndir, char *npath, uid_t owner
 	int errno_save;
 
 	ret = linkat(odir, opath, ndir, npath, 0);
-	if (ret < 0)
+	if (ret == 0)
+		return 0;
+
+	if (!( (errno == EPERM) && (root_ns_mask & CLONE_NEWUSER) )) {
+		errno_save = errno;
 		pr_perror("Can't link %s -> %s", opath, npath);
-	if (ret == 0 || errno != EPERM || !(root_ns_mask & CLONE_NEWUSER))
+		errno = errno_save;
 		return ret;
+	}
 
 	/*
 	 * Kernel before 4.3 has strange secutiry restrictions about


More information about the CRIU mailing list