Florian Obser([email protected]) on 2017.07.27 19:48:24 +0000:
> /usr/src/usr.bin/netstat/inet.c:342:19: warning: comparison of unsigned
> expression < 0 is always false [-Wtautological-compare]
> if (kf->t_state < 0 || kf->t_state >= TCP_NSTATES)
> ~~~~~~~~~~~ ^ ~
>
> t_state is uint32_t, I was toying with the idea of printing is as a
> short which is what we originally get passed in, but I think it's
> better for debugging purposes to show what we actually got hence the %u.
>
> OK?
ok benno@
> diff --git usr.bin/netstat/inet.c usr.bin/netstat/inet.c
> index 979750dad8e..dd10b6ee834 100644
> --- usr.bin/netstat/inet.c
> +++ usr.bin/netstat/inet.c
> @@ -339,8 +339,8 @@ netdomainpr(struct kinfo_file *kf, int proto)
> inetprint(&faddr, kf->inp_fport, name, 0);
> }
> if (istcp) {
> - if (kf->t_state < 0 || kf->t_state >= TCP_NSTATES)
> - printf(" %d", kf->t_state);
> + if (kf->t_state >= TCP_NSTATES)
> + printf(" %u", kf->t_state);
> else
> printf(" %s", tcpstates[kf->t_state]);
> } else if (kf->so_type == SOCK_RAW) {
>
> --
> I'm not entirely sure you are real.
>