[v6,13/13] sysctl: fix sysctl file to close in error path

Submitted by Pavel Tikhomirov on April 25, 2016, 2:56 p.m.

Details

Message ID 1461596214-20999-14-git-send-email-ptikhomirov@virtuozzo.com
State Rejected
Series "net/ipv6: c/r dev/default/all conf ops"
Headers show

Commit Message

Pavel Tikhomirov April 25, 2016, 2:56 p.m.
https://jira.sw.ru/browse/PSBM-30942

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 criu/sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/criu/sysctl.c b/criu/sysctl.c
index d8fa04a..d44db6a 100644
--- a/criu/sysctl.c
+++ b/criu/sysctl.c
@@ -378,9 +378,9 @@  static int __nonuserns_sysctl_op(struct sysctl_req *req, size_t nr_req, int op)
 		req->flags |= CTL_FLAGS_HAS;
 
 		ret = do_sysctl_op(fd, req, op);
+		close(fd);
 		if (ret)
 			goto out;
-		close(fd);
 		req++;
 	}