[CRIU] [PATCH 9/9] parse_pid_stat(): minor optimization

Kir Kolyshkin kir at openvz.org
Wed Oct 7 02:44:24 PDT 2015


Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 proc_parse.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/proc_parse.c b/proc_parse.c
index 3910590..965c7cb 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -622,12 +622,11 @@ int parse_pid_stat(pid_t pid, struct proc_pid_stat *s)
 		return -1;
 
 	n = read(fd, buf, BUF_SIZE);
+	close(fd);
 	if (n < 1) {
 		pr_err("stat for %d is corrupted\n", pid);
-		close(fd);
 		return -1;
 	}
-	close(fd);
 
 	memset(s, 0, sizeof(*s));
 
-- 
2.4.3



More information about the CRIU mailing list