diff options
author | delphij <delphij@FreeBSD.org> | 2009-03-23 23:43:07 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2009-03-23 23:43:07 +0000 |
commit | 78c7bc43defdc06fa3a85bdd27b7048a88f938f4 (patch) | |
tree | 6c51f1fc5bda911e64c6e2619223be37b8c8aec9 /lib/libc/db/btree | |
parent | 58a5285ab7f65111452430c6753a6cbff4f7c5a9 (diff) | |
download | FreeBSD-src-78c7bc43defdc06fa3a85bdd27b7048a88f938f4.zip FreeBSD-src-78c7bc43defdc06fa3a85bdd27b7048a88f938f4.tar.gz |
Save errno before calling _close(), which may clear it.
Obtained from: OpenBSD
Diffstat (limited to 'lib/libc/db/btree')
-rw-r--r-- | lib/libc/db/btree/bt_open.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/db/btree/bt_open.c b/lib/libc/db/btree/bt_open.c index fb7333e..393358f 100644 --- a/lib/libc/db/btree/bt_open.c +++ b/lib/libc/db/btree/bt_open.c @@ -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); } |