[pacman-dev] [PATCH] query_fileowner: break/continue pkgfile loop
Andrew Gregory
andrew.gregory.8 at gmail.com
Sat Jul 7 15:12:49 EDT 2012
Break out of pkgfile loop on match or continue if
the pkgfile path is too long.
Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
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);
}
--
1.7.11.1
More information about the pacman-dev
mailing list