[ltt-dev] [LTTV PATCH] Fix remaining warnings

Alexandre Montplaisir alexandre.montplaisir at polymtl.ca
Tue Jan 25 20:06:12 EST 2011


On 11-01-25 07:59 PM, Mathieu Desnoyers wrote:
> * Alexandre Montplaisir (alexandre.montplaisir at polymtl.ca) wrote:
>> Add and check the return values of fscanf, fread and asprintf functions.
>>
>> That should be it! GCC 4.5 with -Wall doesn't report anything else.
>>
>> Signed-off-by: Alexandre Montplaisir <alexandre.montplaisir at polymtl.ca>
>> ---
>>  lttv/lttv/attribute.c           |    8 ++--
>>  lttv/lttv/state.c               |   72 ++++++++++++++++++++++++---------------
>>  lttv/modules/text/depanalysis.c |   23 +++++++++----
>>  3 files changed, 64 insertions(+), 39 deletions(-)
>>
>> diff --git a/lttv/lttv/attribute.c b/lttv/lttv/attribute.c
>> index 243fe02..3b09468 100644
>> --- a/lttv/lttv/attribute.c
>> +++ b/lttv/lttv/attribute.c
>> @@ -487,13 +487,13 @@ lttv_attribute_read_xml(LttvAttribute *self, FILE *fp)
>>  
>>  	LttvAttribute *subtree;
>>  
>> -	fscanf(fp,"<ATTRS>");
>> +	res = fscanf(fp, "<ATTRS>");
> Is it me or you forgot to check res here ?

Yeah, I omitted it on purpose, since we're feeding it a literal anyway.
The "res =", albeit useless, suppresses the warning.
Would you rather have it check for res > 0 ?

-- 
Alexandre Montplaisir
DORSAL lab,
École Polytechnique de Montréal





More information about the lttng-dev mailing list