[Libosinfo] [libosinfo] osinfo-query: return failure when no matches are found

Fabiano Fidêncio fidencio at redhat.com
Fri Jul 1 08:57:44 UTC 2016


On Fri, Jul 1, 2016 at 10:46 AM, Christophe Fergeau <cfergeau at redhat.com> wrote:
> On Thu, Jun 30, 2016 at 07:04:10PM +0200, Fabiano Fidêncio wrote:
>> According to `man osinfo-query`: "The exit status will be 0 if matching
>> entries were found, or 1 if not matches were found". So, let's adapt the
>> program in order to match the manual.
>>
>> Also, this patch was written keeping the current behavior about printing
>> the Short ID, Name, Version, ID table.
>>
>> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1351718
>>
>> Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
>> ---
>>  tools/osinfo-query.c | 14 ++++++++++++--
>>  1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/osinfo-query.c b/tools/osinfo-query.c
>> index 66f49e2..48e792f 100644
>> --- a/tools/osinfo-query.c
>> +++ b/tools/osinfo-query.c
>> @@ -331,6 +331,9 @@ static gboolean print_results_text(OsinfoList *list,
>>      }
>>      g_print("\n");
>>
>> +    if (tmp == NULL)
>> +        goto end;
>> +
>
> You could add a short /* No match /* comment before this if() or the
> goto.

Suggestion taken, patch pushed!

Best Regards,
-- 
Fabiano Fidêncio




More information about the Libosinfo mailing list