mdbx: fix minor defects (coverity).

Change-Id: I1a5b0788a87ab2a138b342140648642fd5855ae3
This commit is contained in:
Leo Yuriev 2017-07-04 13:06:32 +03:00
parent 66f8327642
commit 14484a6f32
2 changed files with 6 additions and 2 deletions

View File

@ -3849,8 +3849,10 @@ static int mdbx_sync_locked(MDBX_env *env, unsigned flags,
target = mdbx_meta_ancient(env, meta1, meta2, true); target = mdbx_meta_ancient(env, meta1, meta2, true);
else if (head == meta1) else if (head == meta1)
target = mdbx_meta_ancient(env, meta0, meta2, true); target = mdbx_meta_ancient(env, meta0, meta2, true);
else if (head == meta2) else {
mdbx_assert(env, head == meta2);
target = mdbx_meta_ancient(env, meta0, meta1, true); target = mdbx_meta_ancient(env, meta0, meta1, true);
}
/* LY: step#2 - update meta-page. */ /* LY: step#2 - update meta-page. */
mdbx_debug( mdbx_debug(
@ -6190,6 +6192,7 @@ static int mdbx_cursor_first(MDBX_cursor *mc, MDBX_val *key, MDBX_val *data) {
if (likely(data)) { if (likely(data)) {
if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (F_ISSET(leaf->mn_flags, F_DUPDATA)) {
mdbx_cassert(mc, mc->mc_xcursor != nullptr);
mdbx_xcursor_init1(mc, leaf); mdbx_xcursor_init1(mc, leaf);
rc = mdbx_cursor_first(&mc->mc_xcursor->mx_cursor, data, NULL); rc = mdbx_cursor_first(&mc->mc_xcursor->mx_cursor, data, NULL);
if (unlikely(rc)) if (unlikely(rc))
@ -6233,6 +6236,7 @@ static int mdbx_cursor_last(MDBX_cursor *mc, MDBX_val *key, MDBX_val *data) {
if (likely(data)) { if (likely(data)) {
if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (F_ISSET(leaf->mn_flags, F_DUPDATA)) {
mdbx_cassert(mc, mc->mc_xcursor != nullptr);
mdbx_xcursor_init1(mc, leaf); mdbx_xcursor_init1(mc, leaf);
rc = mdbx_cursor_last(&mc->mc_xcursor->mx_cursor, data, NULL); rc = mdbx_cursor_last(&mc->mc_xcursor->mx_cursor, data, NULL);
if (unlikely(rc)) if (unlikely(rc))

View File

@ -549,7 +549,7 @@ int mdbx_write(mdbx_filehandle_t fd, const void *buf, size_t bytes) {
sigset_t set, old; sigset_t set, old;
sigemptyset(&set); sigemptyset(&set);
sigaddset(&set, SIGPIPE); sigaddset(&set, SIGPIPE);
int rc = rc = pthread_sigmask(SIG_BLOCK, &set, &old); int rc = pthread_sigmask(SIG_BLOCK, &set, &old);
if (rc != 0) if (rc != 0)
return rc; return rc;
#endif #endif