[pacman-dev] CVS update of pacman-lib/src/pacman (query.c)

Aaron Griffin aaron at archlinux.org
Wed Jan 31 03:00:50 EST 2007


    Date: Wednesday, January 31, 2007 @ 03:00:50
  Author: aaron
    Path: /home/cvs-pacman/pacman-lib/src/pacman

Modified: query.c (1.20 -> 1.21)

* Make -Qo work on multiple files again
* no real sense in query_fileowner returning an int


---------+
 query.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)


Index: pacman-lib/src/pacman/query.c
diff -u pacman-lib/src/pacman/query.c:1.20 pacman-lib/src/pacman/query.c:1.21
--- pacman-lib/src/pacman/query.c:1.20	Wed Jan 31 01:10:22 2007
+++ pacman-lib/src/pacman/query.c	Wed Jan 31 03:00:50 2007
@@ -39,7 +39,7 @@
 extern config_t *config;
 extern pmdb_t *db_local;
 
-static int query_fileowner(pmdb_t *db, char *filename)
+static void query_fileowner(pmdb_t *db, char *filename)
 {
 	struct stat buf;
 	int gotcha = 0;
@@ -47,16 +47,16 @@
 	alpm_list_t *i, *j;
 
 	if(db == NULL) {
-		return(0);
+		return;
 	}
 	if(filename == NULL || strlen(filename) == 0) {
 		ERR(NL, _("no file was specified for --owns\n"));
-		return(1);
+		return;
 	}
 
 	if(stat(filename, &buf) == -1 || S_ISDIR(buf.st_mode) || realpath(filename, rpath) == NULL) {
-		ERR(NL, _("%s is not a file.\n"), filename);
-		return(1);
+		/* fail silently if we're a directory */
+		return;
 	}
 
 	for(i = alpm_db_getpkgcache(db); i && !gotcha; i = alpm_list_next(i)) {
@@ -76,10 +76,7 @@
 	}
 	if(!gotcha) {
 		ERR(NL, _("No package owns %s\n"), filename);
-		return(1);
 	}
-
-	return(0);
 }
 
 int pacman_query(alpm_list_t *targets)
@@ -195,7 +192,8 @@
 
 		/* determine the owner of a file */
 		if(config->op_q_owns) {
-			return(query_fileowner(db_local, package));
+			query_fileowner(db_local, package);
+			continue;
 		}
 
 		/* find packages in the db */




More information about the pacman-dev mailing list