files: Do not lost original errno value

Submitted by Kirill Tkhai on Feb. 1, 2017, 10:02 a.m.

Details

Message ID 148594334605.9802.14899573621050071533.stgit@localhost.localdomain
State Superseded
Series "files: Do not lost original errno value"
Headers show

Commit Message

Kirill Tkhai Feb. 1, 2017, 10:02 a.m.
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@openvz.org>
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/files-reg.c |    2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

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;
 	}
 

Comments

Cyrill Gorcunov Feb. 1, 2017, 10:47 a.m.
On Wed, Feb 01, 2017 at 01:02:34PM +0300, Kirill Tkhai wrote:
> 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@openvz.org>
> Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Kirill Tkhai Feb. 1, 2017, 11:19 a.m.
On 01.02.2017 14:12, Patchwork wrote:
> == Series Details ==
> 
> Series: files: Do not lost original errno value
> URL   : https://patchwork.criu.org/series/1174/
> State : failure
> 
> == Logs ==
> 
> For more details see: https://travis-ci.org/criupatchwork/criu/builds/197248320

Everything is OK
Pavel Emelianov Feb. 6, 2017, 10:13 a.m.
Applied