commit 122f9363682e5de8ce4056c4c05c1eaf8935cf19
parent 6c7a5b92bdfe68e847d371cc41f6655df3ef1ba5
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Wed, 21 Jul 2021 11:17:53 +0000
Save errno when freeing a cdb
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/libstddjb/cdb_free.c b/src/libstddjb/cdb_free.c
@@ -1,10 +1,17 @@
/* ISC license. */
#include <sys/mman.h>
+#include <errno.h>
+
#include <skalibs/cdb.h>
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 ;
}