From 122f9363682e5de8ce4056c4c05c1eaf8935cf19 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 21 Jul 2021 11:17:53 +0000 Subject: Save errno when freeing a cdb Signed-off-by: Laurent Bercot --- src/libstddjb/cdb_free.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/libstddjb') diff --git a/src/libstddjb/cdb_free.c b/src/libstddjb/cdb_free.c index 04ebf3e..d4250ec 100644 --- a/src/libstddjb/cdb_free.c +++ b/src/libstddjb/cdb_free.c @@ -1,10 +1,17 @@ /* ISC license. */ #include +#include + #include extern void cdb_free (struct cdb *c) { - if (c->map) munmap(c->map, c->size) ; + if (c->map) + { + int e = errno ; + munmap(c->map, c->size) ; + errno = e ; + } *c = cdb_zero ; } -- cgit v1.2.3