Blame 0001-Fix-regression-causing-segfault-on-database-autodete.patch
|
Panu Matilainen |
422abd |
From 853c48ba6468ce1a516621a2fa6d1fc51e4f7410 Mon Sep 17 00:00:00 2001
|
|
Panu Matilainen |
422abd |
Message-Id: <853c48ba6468ce1a516621a2fa6d1fc51e4f7410.1589277227.git.pmatilai@redhat.com>
|
|
Panu Matilainen |
422abd |
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Panu Matilainen |
422abd |
Date: Thu, 2 Apr 2020 09:14:36 +0300
|
|
Panu Matilainen |
422abd |
Subject: [PATCH] Fix regression causing segfault on database autodetection
|
|
Panu Matilainen |
422abd |
|
|
Panu Matilainen |
422abd |
If configuration points to non-existent backend, tryBackend() will
|
|
Panu Matilainen |
422abd |
segfault on the first call. Duh. Regression introduced in commit
|
|
Panu Matilainen |
422abd |
3eb0eed3806b41efdf86f0433d0b5d7d6c953561.
|
|
Panu Matilainen |
422abd |
---
|
|
Panu Matilainen |
422abd |
lib/backend/dbi.c | 2 +-
|
|
Panu Matilainen |
422abd |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Panu Matilainen |
422abd |
|
|
Panu Matilainen |
422abd |
diff --git a/lib/backend/dbi.c b/lib/backend/dbi.c
|
|
Panu Matilainen |
422abd |
index b51fc7ba3..94823b14c 100644
|
|
Panu Matilainen |
422abd |
--- a/lib/backend/dbi.c
|
|
Panu Matilainen |
422abd |
+++ b/lib/backend/dbi.c
|
|
Panu Matilainen |
422abd |
@@ -52,7 +52,7 @@ dbiIndex dbiNew(rpmdb rdb, rpmDbiTagVal rpmtag)
|
|
Panu Matilainen |
422abd |
static int tryBackend(const char *dbhome, const struct rpmdbOps_s *be)
|
|
Panu Matilainen |
422abd |
{
|
|
Panu Matilainen |
422abd |
int rc = 0;
|
|
Panu Matilainen |
422abd |
- if (be->path) {
|
|
Panu Matilainen |
422abd |
+ if (be && be->path) {
|
|
Panu Matilainen |
422abd |
char *path = rstrscat(NULL, dbhome, "/", be->path, NULL);
|
|
Panu Matilainen |
422abd |
rc = (access(path, F_OK) == 0);
|
|
Panu Matilainen |
422abd |
free(path);
|
|
Panu Matilainen |
422abd |
--
|
|
Panu Matilainen |
422abd |
2.26.2
|
|
Panu Matilainen |
422abd |
|