This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix a regression of dwfl_core_file_report retval


On Thu, 2013-11-07 at 16:56 +0100, Jan Kratochvil wrote:
> > >    /* We return the number of modules we found if we found any.
> > >       If we found none, we return -1 instead of 0 if there was an
> > >       error rather than just nothing found.  */
> > > -  return sniffed || listed >= 0 ? listed + sniffed : listed;
> > > +  return listed > 0 ? listed : retval;
> > 
> > The comment doesn't match anymore when retval == 0.
> > This looks simpler:
> > 
> >   return listed > 0 ? listed : -1;
> 
> The comment is right and the code in my patch is also right.  You broke it.
> 
> dwfl_link_map_report returns > 0 if it found any modules.
> dwfl_link_map_report returns 0 if no error happened but just no valid new
>                                   modules were reported.  Still for example
>                                   module candidates could be stored into
>                                   struct r_debug_info.
> dwfl_link_map_report returns -1 if an error happened, such as unreadable
>                                    address in memory.
> 
> So I would leave it as is, do you agree?

Your version is indeed right. I misread the comment.
I missed the "if there was an error" part. Doh.

Thanks,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]