On 08/07/12 05:12, Andrew Gregory wrote: > Break out of pkgfile loop on match or continue if > the pkgfile path is too long.
I agree with the continue - it is stupid we check the length and then do nothing when it fails.... However, I do not agree with the two breaks. The breaks make the whole "found = 1" redundant. And that is useful for directory ownership querying with a loop using "(!found || isdir)", which all -Qo <dir> patches have used so far. You can either ping a patch with the just continue or let me know and I will make one to push. Allam > Signed-off-by: Andrew Gregory <[email protected]> > --- > src/pacman/query.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/src/pacman/query.c b/src/pacman/query.c > index 9b1ea6f..a14b3e3 100644 > --- a/src/pacman/query.c > +++ b/src/pacman/query.c > @@ -212,12 +212,14 @@ static int query_fileowner(alpm_list_t *targets) > if(strcmp(pkgfile, bname) == 0) { > print_query_fileowner(filename, > info); > found = 1; > + break; > } > continue; > } > > if(rootlen + 1 + strlen(pkgfile) > PATH_MAX) { > pm_printf(ALPM_LOG_ERROR, _("path too > long: %s%s\n"), root, pkgfile); > + continue; > } > /* concatenate our file and the root path */ > strcpy(path + rootlen, pkgfile); > @@ -229,6 +231,8 @@ static int query_fileowner(alpm_list_t *targets) > if(ppath && strcmp(ppath, rpath) == 0) { > print_query_fileowner(filename, info); > found = 1; > + free(ppath); > + break; > } > free(ppath); > } >
