Preben Guldberg writes:

> Looking through the code for vmctl, I came across a repeated memcpy() in
> vmctl/main.c.
>
> In the checks below, ret is  either set by a memcpy() or defaulted to 0.
>
> If set by memcpy(), and ret != 0, the memcpy() is repeated verbatim,
> which seems unnecessary.
>

Committed. Thanks! (ok mlarkin@)


> diff 09b708f572d76de8db7f7948ea7359b19bbd1c5a /usr/src
> blob - 249eaa3ded1ee9c804a81874613c292a74ea4b21
> file + usr.sbin/vmctl/main.c
> --- usr.sbin/vmctl/main.c
> +++ usr.sbin/vmctl/main.c
> @@ -300,13 +300,12 @@ vmmaction(struct parse_result *res)
>                       if (imsg.hdr.type == IMSG_CTL_FAIL) {
>                               if (IMSG_DATA_SIZE(&imsg) == sizeof(ret))
>                                       memcpy(&ret, imsg.data, sizeof(ret));
>                               else
>                                       ret = 0;
>                               if (ret != 0) {
> -                                     memcpy(&ret, imsg.data, sizeof(ret));
>                                       errno = ret;
>                                       err(1, "command failed");
>                               } else
>                                       errx(1, "command failed");
>                       }
>


--
-Dave Voutila

Reply via email to