[PATCH 2/4] Handle asprintf return value.

Peter Hutterer peter.hutterer at who-t.net
Sun Aug 25 15:01:45 PDT 2013


On Fri, Aug 23, 2013 at 07:31:48PM +0200, Martin Minarik wrote:
> Fix compiler warning. In case it returns -1, halt the lookup
> and return NULL.
> ---
>  test/test-common-uinput.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/test/test-common-uinput.c b/test/test-common-uinput.c
> index b99bfa8..9f0198b 100644
> --- a/test/test-common-uinput.c
> +++ b/test/test-common-uinput.c
> @@ -154,7 +154,8 @@ wait_for_inotify(int fd)
>  
>  		while (bufidx > sizeof(*e) && bufidx >= sizeof(*e) + e->len) {
>  			if (strncmp(e->name, "event", 5) == 0) {
> -				asprintf(&devnode, "%s%s", DEV_INPUT_DIR, e->name);
> +				if (-1 == asprintf(&devnode, "%s%s", DEV_INPUT_DIR, e->name))
> +					return NULL;

I'll skip this one, simply because it's about to be removed anyway once I
merge the uinput branch.

Cheers,
   Peter

>  				found = 1;
>  				break;
>  			}
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Input-tools mailing list
> Input-tools at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/input-tools


More information about the Input-tools mailing list