I had this diff in my tree for a while, but haven't gotten around
to passing it up.

there are other warnings in the tree, found by newer clang, that
people should review.  Some of them are just noise, in particular
relating to missing {}.

Theo Buehler <[email protected]> wrote:

> clang 10 complains:
> 
> /usr/src/usr.sbin/vmctl/vmctl.c:792:35: warning: comparing a pointer to a 
> null character
>       constant; did you mean to compare to NULL? [-Wpointer-compare]
>                                     '/')) == NULL || ++tty == '\0')
>                                                               ^~~~
>                                                               (void *)0
> The intent is probably rather this:
> 
> Index: vmctl.c
> ===================================================================
> RCS file: /var/cvs/src/usr.sbin/vmctl/vmctl.c,v
> retrieving revision 1.74
> diff -u -p -r1.74 vmctl.c
> --- vmctl.c   11 Mar 2020 12:47:49 -0000      1.74
> +++ vmctl.c   2 Sep 2020 18:06:47 -0000
> @@ -789,7 +789,7 @@ print_vm_info(struct vmop_info_result *l
>                                       tty = "-";
>                               /* get tty - skip /dev/ path */
>                               else if ((tty = strrchr(vmi->vir_ttyname,
> -                                 '/')) == NULL || ++tty == '\0')
> +                                 '/')) == NULL || *++tty == '\0')
>                                       tty = list[i].vir_ttyname;
>  
>                               (void)fmt_scaled(vir->vir_used_size, curmem);
> 

Reply via email to