queries relative paths correctly (thanks to Johnie Stafford)
authorewt <devnull@localhost>
Mon, 15 Apr 1996 21:06:26 +0000 (21:06 +0000)
committerewt <devnull@localhost>
Mon, 15 Apr 1996 21:06:26 +0000 (21:06 +0000)
CVS patchset: 535
CVS date: 1996/04/15 21:06:26

query.c

diff --git a/query.c b/query.c
index c6759cc..d96982c 100644 (file)
--- a/query.c
+++ b/query.c
@@ -7,6 +7,7 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <time.h>
+#include <sys/param.h>
 #include <unistd.h>
 
 #include "lib/messages.h"
@@ -478,6 +479,11 @@ int doQuery(char * prefix, enum querysources source, int queryFlags,
 
       case QUERY_SPATH:
       case QUERY_PATH:
+       if (*arg != '/') {
+           char path[255];
+           if (realpath(arg, path) != NULL)
+               arg = path;
+       }
        if (rpmdbFindByFile(db, arg, &matches)) {
            fprintf(stderr, "file %s is not owned by any package\n", arg);
            retcode = 1;