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
