71 lines
2.0 KiB
Diff
71 lines
2.0 KiB
Diff
From 6e6be7d6ebd5e85c5c8ee7474b476c1038d07af8 Mon Sep 17 00:00:00 2001
|
|
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Date: Tue, 2 Feb 2021 14:00:32 +0200
|
|
Subject: [PATCH] Fix rpmtsInitDB() argument confusion
|
|
|
|
Since it's introduction, rpmtsInitDB() has passed the second argument
|
|
directly to rpmdbInit() as permission bits. However commit
|
|
81fef9848051e5068694cde9b3c2be743d5a93e1 incorrectly documented this
|
|
as being related to the db mode read/write *mode*, and also used it
|
|
that way in the python bindings.
|
|
---
|
|
lib/rpmts.c | 4 ++--
|
|
lib/rpmts.h | 5 ++---
|
|
python/rpmts-py.c | 2 +-
|
|
3 files changed, 5 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/lib/rpmts.c b/lib/rpmts.c
|
|
index 8c8ae420a..8a6683f9a 100644
|
|
--- a/lib/rpmts.c
|
|
+++ b/lib/rpmts.c
|
|
@@ -104,12 +104,12 @@ int rpmtsOpenDB(rpmts ts, int dbmode)
|
|
return rc;
|
|
}
|
|
|
|
-int rpmtsInitDB(rpmts ts, int dbmode)
|
|
+int rpmtsInitDB(rpmts ts, int perms)
|
|
{
|
|
rpmtxn txn = rpmtxnBegin(ts, RPMTXN_WRITE);
|
|
int rc = -1;
|
|
if (txn)
|
|
- rc = rpmdbInit(ts->rootDir, dbmode);
|
|
+ rc = rpmdbInit(ts->rootDir, perms);
|
|
rpmtxnEnd(txn);
|
|
return rc;
|
|
}
|
|
diff --git a/lib/rpmts.h b/lib/rpmts.h
|
|
index e04d9e5e2..eca179009 100644
|
|
--- a/lib/rpmts.h
|
|
+++ b/lib/rpmts.h
|
|
@@ -272,12 +272,11 @@ int rpmtsOpenDB(rpmts ts, int dbmode);
|
|
|
|
/** \ingroup rpmts
|
|
* Initialize the database used by the transaction.
|
|
- * @deprecated An explicit rpmdbInit() is almost never needed.
|
|
* @param ts transaction set
|
|
- * @param dbmode O_RDONLY or O_RDWR
|
|
+ * @param perms database permissions (ie mode bits)
|
|
* @return 0 on success
|
|
*/
|
|
-int rpmtsInitDB(rpmts ts, int dbmode);
|
|
+int rpmtsInitDB(rpmts ts, int perms);
|
|
|
|
/** \ingroup rpmts
|
|
* Return the transaction database mode
|
|
diff --git a/python/rpmts-py.c b/python/rpmts-py.c
|
|
index 27caa0388..4aae43712 100644
|
|
--- a/python/rpmts-py.c
|
|
+++ b/python/rpmts-py.c
|
|
@@ -347,7 +347,7 @@ rpmts_InitDB(rpmtsObject * s)
|
|
{
|
|
int rc;
|
|
|
|
- rc = rpmtsInitDB(s->ts, O_RDONLY);
|
|
+ rc = rpmtsInitDB(s->ts, 0644);
|
|
if (rc == 0)
|
|
rc = rpmtsCloseDB(s->ts);
|
|
|
|
--
|
|
2.27.0
|
|
|