[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b8e4a1c2-2a77-b058-197d-6362dbf43605@gmail.com>
Date: Wed, 3 May 2017 13:05:35 +0900
From: Taeung Song <treeze.taeung@...il.com>
To: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
Cc: linux-kernel@...r.kernel.org, Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH 2/7] perf config: Check list empty before showing configs
Hi Arnaldo,
On 05/03/2017 12:12 AM, Arnaldo Carvalho de Melo wrote:
> Em Wed, Apr 26, 2017 at 09:21:03PM +0900, Taeung Song escreveu:
>> If existent config files contains nothing,
>> the sections list in config_set can be empty.
>>
>> So check not only NULL pointer of config_set but
>> also the list in config_set.
> <SNIP>
>> +++ b/tools/perf/builtin-config.c
>> @@ -75,7 +75,7 @@ static int show_spec_config(struct perf_config_set *set, const char *var)
>> struct perf_config_section *section;
>> struct perf_config_item *item;
>>
>> - if (set == NULL)
>> + if (set == NULL || list_empty(&set->sections))
>> return -1;
>
> But should we consider an error to have an empty config file? I don't
> think so :-\
>
> - Arnaldo
I think if we do, when a config file is not only not exist but also empty,
user can see the error message
(e.g. "Nothing configured, please check your ~/.perfconfig").
And IMHO, it seems better.
But if you don't think so, I got it.
Thanks,
Taeung
Powered by blists - more mailing lists