[PATCH 1/3] Move get_problems_count() to its only user - "abrt-cli status"

Denys Vlasenko dvlasenk at redhat.com
Thu May 23 12:03:33 UTC 2013


On 05/23/2013 12:12 PM, Jakub Filak wrote:
>> +static int count_dir_if_newer_than(struct dump_dir *dd, void *arg)
>> +{
>> +    struct time_range *me = arg;
>> +
>> +    char *time_str = dd_load_text(dd, FILENAME_LAST_OCCURRENCE);
>> +    long val = atol(time_str);
> 
> Old dump directories don't contain FILENAME_LAST_OCCURRENCE.  The line above 
> will cause a crash. 

This patch doesn't change the logic: before the patch, the code was doing
the very same thing: dd_load_text(dd, FILENAME_LAST_OCCURRENCE)

dd_load_text(dd, FILENAME_LAST_OCCURRENCE) doesn't crash
if FILENAME_LAST_OCCURRENCE doesn't exist.
Rather, it returns xstrdup("").
atol("") is 0.

-- 
vda



More information about the Crash-catcher mailing list