On Thu, Jul 18, 2024 at 16:08:06 +0200, Michal Privoznik wrote: ... > diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c > index cdc2a7d87b..1fd8261dc1 100644 > --- a/src/util/virsysinfo.c > +++ b/src/util/virsysinfo.c > @@ -910,9 +910,20 @@ virSysinfoDMIDecodeOEMString(size_t i, > > /* Unfortunately, dmidecode returns 0 even if OEM String index is out > * of bounds, but it prints an error message in that case. Check stderr > - * and return success/failure accordingly. */ > + * and return success/failure accordingly. > + * To make matters worse, if there are two or more 'OEM String' > + * sections then: > + * > + * a) we have no way of distinguishing them as dmidecode prints > + * strings from all sections, > + * b) if one section contains a valid string, but the other doesn't, > + * then stdout contains the valid string and stderr contains the > + * error "No OEM string number X*. > + * > + * Let's just hope there is not many systems like that. > + */ > > - if (err && *err != '\0') > + if (!(*str && **str != '\0') && err && *err != '\0') I think if ((!*str || **str == '\0') && err && *err != '\0') might be a bit easier for humans to parse. At least for me it is easier :-) Jirka