[3/7] mnt: Move ns_fd assignment down in prepare_mnt_ns()

Submitted by Kirill Tkhai on June 28, 2017, 3:54 p.m.

Details

Message ID 149866525672.31392.12894706380989202940.stgit@localhost.localdomain
State New
Series "Skip iteration on open files to find parent's leftovers (optimize child creation)"
Headers show

Commit Message

Kirill Tkhai June 28, 2017, 3:54 p.m.
No functional changes.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/mount.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/mount.c b/criu/mount.c
index 9a08506dd..4274cbd04 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -3040,13 +3040,12 @@  int prepare_mnt_ns(void)
 				pr_perror("Can't restore mntns back");
 				goto err;
 			}
-			nsid->mnt.ns_fd = rst;
-			rst = fd;
-		} else {
-			/* Pin one with a file descriptor */
-			nsid->mnt.ns_fd = fd;
+			SWAP(rst, fd);
 		}
 
+		/* Pin one with a file descriptor */
+		nsid->mnt.ns_fd = fd;
+
 		/* Set its root */
 		path[0] = '/';
 		print_ns_root(nsid, 0, path + 1, sizeof(path) - 1);