[CRIU] [PATCH] posix-timer: take into account that sival_ptr can be NULL

Andrey Vagin avagin at openvz.org
Mon Feb 17 12:25:32 PST 2014


ID: 0
signal: 26/          (null)
notify: signal/pid.5954
ClockID: 1

fscanf "%p" doesn't handle "(null)".

https://bugzilla.openvz.org/show_bug.cgi?id=2894
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 proc_parse.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/proc_parse.c b/proc_parse.c
index 26dd9c4..72fbf1a 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -1289,6 +1289,15 @@ int parse_posix_timers(pid_t pid, struct proc_posix_timers_stat *args)
 				&timer->spt.si_signo, &timer->spt.sival_ptr,
 				sigpid, tidpid, &pid_t,
 				&timer->spt.clock_id);
+		if (ret == 2) {
+			timer->spt.sival_ptr = NULL;
+			ret++;
+			ret += fscanf(file, "ull)\n"
+					   "notify: %6[a-z]/%3[a-z].%d\n"
+					   "ClockID: %d\n",
+					sigpid, tidpid, &pid_t,
+					&timer->spt.clock_id);
+		}
 		if (ret != 7) {
 			ret = 0;
 			xfree(timer);
-- 
1.8.5.3



More information about the CRIU mailing list