Sigh.. when not using environment, absolute paths are required
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 18 Sep 2009 06:49:28 +0000 (09:49 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 18 Sep 2009 06:49:28 +0000 (09:49 +0300)
lib/backend/db3.c

index 88af6a8..92573a0 100644 (file)
@@ -865,7 +865,12 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
            }
 
            if (rc == 0) {
-               rc = (db->open)(db, txnid, dbfile, NULL,
+               char *fullpath = NULL;
+               /* When not in environment, absolute path is needed */
+               if (!dbi->dbi_use_dbenv && !dbi->dbi_temporary) {
+                   fullpath = rpmGetPath(dbhome, "/", dbfile, NULL);
+               }
+               rc = (db->open)(db, txnid, fullpath ? fullpath : dbfile, NULL,
                    dbi->dbi_type, oflags, dbi->dbi_perms);
 
                if (rc == 0 && dbi->dbi_type == DB_UNKNOWN) {
@@ -874,6 +879,7 @@ static int db3open(rpmdb rpmdb, rpmTag rpmtag, dbiIndex * dbip)
                    if (xx == 0)
                        dbi->dbi_type = dbi_type;
                }
+               free(fullpath);
            }
 
            /* XXX return rc == errno without printing */