[CRIU] [PATCH] files: Simplify find_fdinfo_list_entry

Cyrill Gorcunov gorcunov at openvz.org
Tue Mar 20 03:59:00 EDT 2012


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 files.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/files.c b/files.c
index 773193f..39d0a83 100644
--- a/files.c
+++ b/files.c
@@ -213,17 +213,14 @@ static int restore_exe_early(struct fdinfo_entry *fe, int fd)
 struct fdinfo_list_entry *find_fdinfo_list_entry(int pid, int fd, struct fdinfo_desc *fi)
 {
 	struct fdinfo_list_entry *fle;
-	int found = 0;
 
 	list_for_each_entry(fle, &fi->list, list) {
-		if (fle->fd == fd && fle->pid == pid) {
-			found = 1;
-			break;
-		}
+		if (fle->fd == fd && fle->pid == pid)
+			return fle;
 	}
 
-	BUG_ON(found == 0);
-	return fle;
+	BUG_ON(1);
+	return NULL;
 }
 
 static int open_transport_fd(int pid, struct fdinfo_entry *fe,
-- 
1.7.7.6



More information about the CRIU mailing list