[CRIU] [PATCH 1/2] restore: Don't close LAST_PID_PATH descriptor if it was not opened

Cyrill Gorcunov gorcunov at openvz.org
Mon Mar 5 11:44:21 EST 2012


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-restore.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index 720f23f..cbae24a 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1257,7 +1257,7 @@ static inline int fork_with_pid(int pid, unsigned long ns_clone_flags)
 
 	if (flock(ca.fd, LOCK_EX)) {
 		pr_perror("%d: Can't lock %s", pid, LAST_PID_PATH);
-		goto err;
+		goto err_close;
 	}
 
 	if (write_img_buf(ca.fd, buf, strlen(buf)))
@@ -1273,11 +1273,11 @@ err_unlock:
 	if (flock(ca.fd, LOCK_UN))
 		pr_perror("%d: Can't unlock %s", pid, LAST_PID_PATH);
 
+err_close:
+	close_safe(&ca.fd);
 err:
 	if (stack != MAP_FAILED)
 		munmap(stack, STACK_SIZE);
-
-	close_safe(&ca.fd);
 	return ret;
 }
 
-- 
1.7.7.6



More information about the CRIU mailing list