mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Save errno before calling _close(), which may clear it.
Obtained from: OpenBSD
This commit is contained in:
parent
7efabbb915
commit
6c0af71bdc
1 changed files with 4 additions and 2 deletions
|
|
@ -96,7 +96,7 @@ __bt_open(const char *fname, int flags, int mode, const BTREEINFO *openinfo, int
|
|||
DB *dbp;
|
||||
pgno_t ncache;
|
||||
ssize_t nr;
|
||||
int machine_lorder;
|
||||
int machine_lorder, saved_errno;
|
||||
|
||||
t = NULL;
|
||||
|
||||
|
|
@ -327,13 +327,15 @@ einval: errno = EINVAL;
|
|||
eftype: errno = EFTYPE;
|
||||
goto err;
|
||||
|
||||
err: if (t) {
|
||||
err: saved_errno = errno;
|
||||
if (t) {
|
||||
if (t->bt_dbp)
|
||||
free(t->bt_dbp);
|
||||
if (t->bt_fd != -1)
|
||||
(void)_close(t->bt_fd);
|
||||
free(t);
|
||||
}
|
||||
errno = saved_errno;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue