[CRIU] [PATCH] files: Do not lost original errno value

Kirill Tkhai ktkhai at virtuozzo.com
Wed Feb 1 02:02:34 PST 2017


The callers of rfi_remap() are interested in a errno,
linkat_hard() returns. So, preserve errno before we
call rm_parent_dirs().

Reported-by: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/files-reg.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/criu/files-reg.c b/criu/files-reg.c
index 81982e052..fbedec5ea 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -1418,7 +1418,9 @@ static int rfi_remap(struct reg_file_info *rfi, int *level)
 
 	if (linkat_hard(mntns_root, rpath, mntns_root, path,
 			rfi->remap->uid, rfi->remap->gid, 0) < 0) {
+		int errno_saved = errno;
 		rm_parent_dirs(mntns_root, path, *level);
+		errno = errno_saved;
 		return -1;
 	}
 



More information about the CRIU mailing list