On Fri, May 14, 2021, 16:12 Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > > On Fri, 14 May 2021 07:10:51 +0300 > Tzvetomir Stoyanov <tz.stoyanov@xxxxxxxxx> wrote: > > > > @@ -3250,10 +3282,18 @@ static char *parse_guest_name(char *gname, int *cid, int *port) > > > } else if (is_digits(gname)) > > > *cid = atoi(gname); > > > > > > - read_qemu_guests(); > > > + if (*cid < 0) > > > + read_qemu_guests(); > > > + > > > + if (*cid < 0) > > > + return NULL; > > > > This check is not needed. If cid is not part of the string, let > > read_qemu_guests() to try discover the VMs, instead of returning NULL. > > I'm confused. That's basically what the above does. > > *cid = -1; > > if (<cid is in name>) { > *cid = look_for_cid_via_tracing(); > } > > if (*cid < -1) > read_qemu_guests(); > > That is, if the cid isn't part of the name, then it will call > read_qemu_guests(). > > The second check is in case the read_qemu_guests() fails to find the cid > either. > > What am I missing? cid is not updated between both checks, it always fails - even though read_qemu_guests() may succeed to find the VM with that name. > > -- Steve