]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added asserts to make static analyzer happier.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 9 Sep 2016 15:10:29 +0000 (18:10 +0300)
committerGitLab <gitlab@git.dovecot.net>
Tue, 13 Sep 2016 14:51:25 +0000 (17:51 +0300)
src/lib-fs/fs-posix.c
src/lib-index/mailbox-log.c
src/lib-stats/stats-connection.c
src/lib-storage/index/imapc/imapc-mail.c
src/lib/istream-file.c
src/login-common/login-proxy-state.c
src/plugins/fts/fts-api.c
src/plugins/virtual/virtual-mail.c

index a4baeae36d9afaec6a05fda3319ce0fc3535725e..43bd26180bdbd1f4a072ab5c09c87a8d4cd56122 100644 (file)
@@ -495,6 +495,7 @@ static int fs_posix_write(struct fs_file *_file, const void *data, size_t size)
        if (file->fd == -1) {
                if (fs_posix_open(file) < 0)
                        return -1;
+               i_assert(file->fd != -1);
        }
 
        if (file->open_mode != FS_OPEN_MODE_APPEND) {
index 33305171b4a8f5bda6a0d54fbf739502eb697d7f..11f1824ef7b3dd58d2bebc1de495aed0a5017bd1 100644 (file)
@@ -176,6 +176,7 @@ int mailbox_log_append(struct mailbox_log *log,
        if (log->fd == -1) {
                if (mailbox_log_open(log) < 0)
                        return -1;
+               i_assert(log->fd != -1);
        }
 
        /* We don't bother with locking, atomic appends will protect us.
index f342626656b0264d3fdffb961e646bc0e3c643f0..6172abc8072097d6585005614442d14b66580a73 100644 (file)
@@ -83,6 +83,7 @@ int stats_connection_send(struct stats_connection *conn, const string_t *str)
        if (conn->fd == -1) {
                if (!stats_connection_open(conn))
                        return -1;
+               i_assert(conn->fd != -1);
        }
 
        if (str_len(str) > PIPE_BUF && !pipe_warned) {
index b520e4e69e8f13f61eeeaf030cbf313c8ad91bab..b040e2d6f53f96084a51d624391e6dd307bbe817 100644 (file)
@@ -187,6 +187,7 @@ static int imapc_mail_get_physical_size(struct mail *_mail, uoff_t *size_r)
        old_offset = data->stream == NULL ? 0 : data->stream->v_offset;
        if (mail_get_stream(_mail, NULL, NULL, &input) < 0)
                return -1;
+       i_assert(data->stream != NULL);
        i_stream_seek(data->stream, old_offset);
 
        ret = i_stream_get_size(data->stream, TRUE,
index 15cdc21e767e7e1ff691bc4445f79d4516835d98..da25090c45e01435cafc7fba4f7dccb425e53088 100644 (file)
@@ -54,6 +54,7 @@ ssize_t i_stream_file_read(struct istream_private *stream)
        if (stream->fd == -1) {
                if (i_stream_file_open(stream) < 0)
                        return -1;
+               i_assert(stream->fd != -1);
        }
 
        offset = stream->istream.v_offset + (stream->pos - stream->skip);
index 1200904ff2f3a23c360f4d4ccc8ca77eb6210d8e..4c82345df8d4afd64d6705c6eff06877e14eb294 100644 (file)
@@ -138,6 +138,7 @@ static bool login_proxy_state_try_notify(struct login_proxy_state *state,
        if (state->notify_fd == -1) {
                if (login_proxy_state_notify_open(state) < 0)
                        return TRUE;
+               i_assert(state->notify_fd != -1);
        }
 
        T_BEGIN {
index 5eec770bc85187860db7ed32997cb2f0c276dd61..a12c1903d385c208f2fd48305695d9ca1b39bdf9 100644 (file)
@@ -125,6 +125,7 @@ static void fts_backend_set_cur_mailbox(struct fts_backend_update_context *ctx)
 {
        fts_backend_update_unset_build_key(ctx);
        if (ctx->backend_box != ctx->cur_box) {
+               i_assert(ctx->cur_box != NULL);
                ctx->backend->v.update_set_mailbox(ctx, ctx->cur_box);
                ctx->backend_box = ctx->cur_box;
        }
index 78443266d9b059b88152f434f598b805f83253b9..21e7519091352c97e21445d5a3895d273f8706e8 100644 (file)
@@ -131,6 +131,7 @@ static int backend_mail_get(struct virtual_mail *vmail,
                        return -1;
                }
                (void)virtual_mail_set_backend_mail(mail, bbox);
+               i_assert(vmail->cur_backend_mail != NULL);
        }
        virtual_backend_box_accessed(mbox, bbox);
        vmail->cur_lost = !mail_set_uid(vmail->cur_backend_mail,