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

Pavel Emelyanov xemul at parallels.com
Tue Feb 18 00:41:31 PST 2014


On 02/18/2014 12:25 AM, Andrey Vagin wrote:
> 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);

Er... Can we make the original scanf be %d/%s and then additionally parse the
obtained string?

> +		}
>  		if (ret != 7) {
>  			ret = 0;
>  			xfree(timer);
> 




More information about the CRIU mailing list