From 1187cf005a2821d5f239bec1a0ecddfef190a125 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 14 Apr 2020 11:22:39 +0200
Subject: [PATCH] ndb: unmap xdb's header when closing the xdb database

Somehow I was under the impression that mapped regions are unmapped when
the corresponding file descriptor is closed, but that's not the case
for POSIX systems.

URL:https://github.com/rpm-software-management/rpm/commit/1187cf005a2821d5f239bec1a0ecddfef190a125
---
 lib/backend/ndb/rpmxdb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/backend/ndb/rpmxdb.c b/lib/backend/ndb/rpmxdb.c
index ec408f8..ab22746 100644
--- a/lib/backend/ndb/rpmxdb.c
+++ b/lib/backend/ndb/rpmxdb.c
@@ -621,6 +621,8 @@ void rpmxdbClose(rpmxdb xdb)
     }
     if (xdb->slots)
 	free(xdb->slots);
+    if (xdb->mapped)
+	unmapheader(xdb);
     if (xdb->fd >= 0)
 	close(xdb->fd);
     if (xdb->filename)
-- 
1.8.3.1

