[CRIU] [PATCH 1/2] parse_fdinfo: Return special error code if opt entry is missing

Cyrill Gorcunov gorcunov at openvz.org
Wed Sep 12 04:21:02 EDT 2012


Reported-by: Andrew Vagin <avagin at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 proc_parse.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/proc_parse.c b/proc_parse.c
index 8023a41..33d9145 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -714,6 +714,16 @@ static void parse_fhandle_encoded(char *tok, FhEntry *fh)
 
 #define fdinfo_field(str, field)	!strncmp(str, field":", sizeof(field))
 
+static bool fdinfo_is_optional(int type)
+{
+	return type == FD_TYPES__EVENTPOLL;
+}
+
+/*
+ *  0 - succes
+ * -1 - error
+ * -2 - optional entry is not found
+ */
 int parse_fdinfo(int fd, int type,
 		int (*cb)(union fdinfo_entries *e, void *arg), void *arg)
 {
@@ -825,6 +835,8 @@ int parse_fdinfo(int fd, int type,
 
 	fclose(f);
 	if (!entry_met) {
+		if (fdinfo_is_optional(type))
+			return -2;
 		pr_err("No records of type %d found in fdinfo file\n", type);
 		goto parse_err;
 	}
-- 
1.7.7.6



More information about the CRIU mailing list