From 644e4fec6b1bfb9fa1e10290f0d5375a2f6ce174 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Mon, 5 Mar 2012 20:44:00 +0400 Subject: [PATCH] restore: Don't close LAST_PID_PATH descriptor if it was not opened Signed-off-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- cr-restore.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cr-restore.c b/cr-restore.c index 720f23f72..cbae24aab 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; }