Mercurial > dovecot > core-2.2
changeset 21519:9722a49567e0
global: Add asserts to make static analyzer happier.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Fri, 10 Feb 2017 13:17:00 +0200 |
parents | ee615b26803d |
children | b1c4db787e1c |
files | src/auth/db-ldap.c src/doveadm/doveadm-mail-index.c src/lib-auth/auth-master.c src/lib-fs/fs-posix.c src/lib-storage/index/mbox/mbox-save.c src/lib-storage/mail-autoexpunge.c src/lib/file-dotlock.c src/lib/iostream-temp.c |
diffstat | 8 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/db-ldap.c Fri Feb 10 13:15:58 2017 +0200 +++ b/src/auth/db-ldap.c Fri Feb 10 13:17:00 2017 +0200 @@ -1428,6 +1428,7 @@ } else if (name[0] == '!' && name == ldap_attr) { /* !ldapAttr */ name = ""; + i_assert(ldap_attr[0] == '!'); ldap_attr++; field->skip = TRUE; }
--- a/src/doveadm/doveadm-mail-index.c Fri Feb 10 13:15:58 2017 +0200 +++ b/src/doveadm/doveadm-mail-index.c Fri Feb 10 13:17:00 2017 +0200 @@ -155,6 +155,7 @@ { if (ctx->queue_fd == -1) index_queue_connect(ctx); + i_assert(ctx->queue_fd != -1); T_BEGIN { string_t *str = t_str_new(256);
--- a/src/lib-auth/auth-master.c Fri Feb 10 13:15:58 2017 +0200 +++ b/src/lib-auth/auth-master.c Fri Feb 10 13:17:00 2017 +0200 @@ -399,6 +399,7 @@ if (conn->fd == -1) { if (auth_master_connect(conn) < 0) return -1; + i_assert(conn->fd != -1); } auth_master_set_io(conn);
--- a/src/lib-fs/fs-posix.c Fri Feb 10 13:15:58 2017 +0200 +++ b/src/lib-fs/fs-posix.c Fri Feb 10 13:17:00 2017 +0200 @@ -558,6 +558,7 @@ _file->output = o_stream_create_error_str(errno, "%s", fs_file_last_error(_file)); } else { + i_assert(file->fd != -1); _file->output = o_stream_create_fd_file(file->fd, (uoff_t)-1, FALSE); }
--- a/src/lib-storage/index/mbox/mbox-save.c Fri Feb 10 13:15:58 2017 +0200 +++ b/src/lib-storage/index/mbox/mbox-save.c Fri Feb 10 13:17:00 2017 +0200 @@ -323,6 +323,7 @@ if (mbox_seek_to_end(ctx, &ctx->append_offset) < 0) return -1; + i_assert(mbox->mbox_fd != -1); ctx->output = o_stream_create_fd_file(mbox->mbox_fd, ctx->append_offset, FALSE);
--- a/src/lib-storage/mail-autoexpunge.c Fri Feb 10 13:15:58 2017 +0200 +++ b/src/lib-storage/mail-autoexpunge.c Fri Feb 10 13:17:00 2017 +0200 @@ -226,6 +226,8 @@ } } if (lock.fd != -1) { + i_assert(lock.lock != NULL); + i_unlink(lock.path); i_close_fd(&lock.fd); file_lock_free(&lock.lock);
--- a/src/lib/file-dotlock.c Fri Feb 10 13:15:58 2017 +0200 +++ b/src/lib/file-dotlock.c Fri Feb 10 13:17:00 2017 +0200 @@ -565,6 +565,7 @@ file_lock_wait_end(dotlock->path); if (ret > 0) { + i_assert(lock_info.fd != -1); if (fstat(lock_info.fd, &st) < 0) { i_error("fstat(%s) failed: %m", lock_path); ret = -1;
--- a/src/lib/iostream-temp.c Fri Feb 10 13:15:58 2017 +0200 +++ b/src/lib/iostream-temp.c Fri Feb 10 13:17:00 2017 +0200 @@ -151,6 +151,7 @@ for (i = 0; i < iov_count; i++) { if (tstream->buf->used + iov[i].iov_len > tstream->max_mem_size) { if (o_stream_temp_move_to_fd(tstream) == 0) { + i_assert(tstream->fd != -1); return o_stream_temp_fd_sendv(tstream, iov+i, iov_count-i); }