added rpmdbOpenForTraversal()
authorewt <devnull@localhost>
Thu, 4 Feb 1999 05:03:16 +0000 (05:03 +0000)
committerewt <devnull@localhost>
Thu, 4 Feb 1999 05:03:16 +0000 (05:03 +0000)
CVS patchset: 2771
CVS date: 1999/02/04 05:03:16

CHANGES
lib/rpmdb.c
lib/rpmlib.h

diff --git a/CHANGES b/CHANGES
index 34632a3..556e385 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
 2.90 -> 2.91
        - create rpmbzio.c to avoid implicit dependence on libbz2 for installer.
        - spec files can provide /filename now
+       - added rpmdbOpenForTraversal()
 
 2.5.x -> 2.90
        - added --excludepath
index ec7f2a6..b974882 100644 (file)
@@ -55,6 +55,23 @@ static int intMatchCmp(const void * one, const void * two) {
     return 0;
 };
 
+int rpmdbOpenForTraversal(const char * prefix, rpmdb * rpmdbp) {
+    const char * dbpath;
+
+    dbpath = rpmGetPath("%{_dbpath}", NULL);
+    if (dbpath == NULL || dbpath[0] == '%') {
+       rpmMessage(RPMMESS_DEBUG, _("no dbpath has been set"));
+       return 1;
+    }
+
+    if (openDatabase(prefix, dbpath, rpmdbp, O_RDONLY, 0644, 
+                    RPMDB_FLAG_MINIMAL)) {
+       return 1;
+    }
+
+    return 0;
+}
+
 int rpmdbOpen (const char * prefix, rpmdb *rpmdbp, int mode, int perms) {
     const char * dbpath;
     int rc;
index 5ad60e8..5cba1f1 100644 (file)
@@ -299,6 +299,9 @@ int rpmdbOpen (const char * root, rpmdb * dbp, int mode, int perms);
 int rpmdbInit(const char * root, int perms);
     /* nonzero on error */
 void rpmdbClose (rpmdb db);
+/* Databases like this should only have rpmdb*RecNum and rpmdbGetRecord
+   used on them. Anything else could fail! */
+int rpmdbOpenForTraversal(const char * prefix, rpmdb * rpmdbp);
 
 int rpmdbFirstRecNum(rpmdb db);
 int rpmdbNextRecNum(rpmdb db, unsigned int lastOffset);