[PATCH 1/3] Move get_problems_count() to its only user - "abrt-cli status"
Jakub Filak
jfilak at redhat.com
Thu May 23 12:27:21 UTC 2013
On Thursday 23 of May 2013 14:03:33 Denys Vlasenko wrote:
> 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.
Please excuse my silly comment. I was lazy to study the code.
dump_dir.h doesn't contain any comment for dd_load_text().
dd_load_text() calls an another undocumented function so I gave up my effort in
reading of dd_load_text().
Anyway, could you please add a ticket number to the commit message?
More information about the Crash-catcher
mailing list