trace-cmd: Do not return zero length name for guest by name
PATCH 1/1 trace-cmd: Do not return zero length name for guest by name
From: "Steven Rostedt (Google)" <[email protected]>
The function trace_get_guest() will first look for a guest by name, and if it finds one, it will return it. But if the guest added did not have a name (but had an empty string), it would return any guest that also did not have a name (but just an empty string). If two guests did not have a name, and the CID was used, then the first guest would be returned for the second guest, breaking the creating of two guests where both were without names.
Signed-off-by Steven Rostedt (Google) <[email protected]>
--- tracecmd/trace-vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tracecmd/trace-vm.c +1 -1
@@ -35,7 +35,7 @@ static struct trace_guest *get_guest_by_name(const char *name) {int i; -if (!guests) +if (!guests || !strlen (name))return NULL ;for (i =0 ; i < guests_len; i++)
Signature · 1 line
2.35.1