[CRIU] [PATCH 1/3] files: Drop redundant lseek in prepare_fds

Cyrill Gorcunov gorcunov at openvz.org
Tue Apr 10 10:47:10 EDT 2012


No need to obtain MAGIC_OFFSET from current position,
the files have predefined structure.

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

diff --git a/files.c b/files.c
index e43372a..25fb837 100644
--- a/files.c
+++ b/files.c
@@ -437,7 +437,6 @@ int prepare_fds(int pid)
 	u32 type = 0, ret;
 	int fdinfo_fd;
 	int state;
-	off_t offset, magic_offset;
 
 	struct fdinfo_entry fe;
 	int nr = 0;
@@ -450,10 +449,8 @@ int prepare_fds(int pid)
 		return -1;
 	}
 
-	magic_offset = lseek(fdinfo_fd, 0, SEEK_CUR);
-
 	for (state = 0; state < FD_STATE_MAX; state++) {
-		lseek(fdinfo_fd, magic_offset, SEEK_SET);
+		lseek(fdinfo_fd, MAGIC_OFFSET, SEEK_SET);
 
 		while (1) {
 			ret = read_img_eof(fdinfo_fd, &fe);
-- 
1.7.7.6



More information about the CRIU mailing list