Theo Buehler wrote: > However, I think the current logic is both wrong and the wrong way > around. I believe the following is much clearer. It doesn't have a dead > else branch and it deletes 'ret', so it doesn't use it uninitialized when > checking 'res->action == CMD_STOPALL && ret != -1' (e.g. 'vmctl stop -a'). > Since the diff is slightly messy, this is the result:
> if (res->action == CMD_STOPALL) { > if (argc != 0) > ctl_usage(res->ctl); > } else { > if (argc != 1) > ctl_usage(res->ctl); > if (parse_vmid(res, argv[0], 0) == -1) > errx(1, "invalid id: %s", argv[0]); > } FWIW, I agree this is clearer. Thanks for the feedback. Preben