mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 08:18:51 -05:00
* Make -Qo work on multiple files again
* no real sense in query_fileowner returning an int
This commit is contained in:
parent
290b962c48
commit
9a98b6b066
@ -39,7 +39,7 @@
|
|||||||
extern config_t *config;
|
extern config_t *config;
|
||||||
extern pmdb_t *db_local;
|
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;
|
struct stat buf;
|
||||||
int gotcha = 0;
|
int gotcha = 0;
|
||||||
@ -47,16 +47,16 @@ static int query_fileowner(pmdb_t *db, char *filename)
|
|||||||
alpm_list_t *i, *j;
|
alpm_list_t *i, *j;
|
||||||
|
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
return(0);
|
return;
|
||||||
}
|
}
|
||||||
if(filename == NULL || strlen(filename) == 0) {
|
if(filename == NULL || strlen(filename) == 0) {
|
||||||
ERR(NL, _("no file was specified for --owns\n"));
|
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) {
|
if(stat(filename, &buf) == -1 || S_ISDIR(buf.st_mode) || realpath(filename, rpath) == NULL) {
|
||||||
ERR(NL, _("%s is not a file.\n"), filename);
|
/* fail silently if we're a directory */
|
||||||
return(1);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = alpm_db_getpkgcache(db); i && !gotcha; i = alpm_list_next(i)) {
|
for(i = alpm_db_getpkgcache(db); i && !gotcha; i = alpm_list_next(i)) {
|
||||||
@ -76,10 +76,7 @@ static int query_fileowner(pmdb_t *db, char *filename)
|
|||||||
}
|
}
|
||||||
if(!gotcha) {
|
if(!gotcha) {
|
||||||
ERR(NL, _("No package owns %s\n"), filename);
|
ERR(NL, _("No package owns %s\n"), filename);
|
||||||
return(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int pacman_query(alpm_list_t *targets)
|
int pacman_query(alpm_list_t *targets)
|
||||||
@ -195,7 +192,8 @@ int pacman_query(alpm_list_t *targets)
|
|||||||
|
|
||||||
/* determine the owner of a file */
|
/* determine the owner of a file */
|
||||||
if(config->op_q_owns) {
|
if(config->op_q_owns) {
|
||||||
return(query_fileowner(db_local, package));
|
query_fileowner(db_local, package);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find packages in the db */
|
/* find packages in the db */
|
||||||
|
Loading…
Reference in New Issue
Block a user