Text   |  XML   |  ReML   |   Visible Warnings:

Unreachable Conditional  at mail-index-modseq.c:396

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

mail_index_modseq_sync_init

(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-index/mail-index-modseq.c)expand/collapse
Show more  
 364  static void mail_index_modseq_sync_init(struct mail_index_modseq_sync *ctx)
 365  {
 366          struct mail_index_map *map = ctx->view->map;
 367          const struct mail_index_ext *ext;
 368          const struct mail_index_modseq_header *hdr;
 369          const struct mail_transaction_header *thdr;
 370          const void *tdata;
 371          uint32_t ext_map_idx;
 372          uint32_t end_seq;
 373          uoff_t end_offset;
 374          uint64_t cur_modseq;
 375          bool reset;
 376          int ret;
 377   
 378          if (!mail_index_map_get_ext_idx(map, ctx->view->index->modseq_ext_id,
 379                                          &ext_map_idx))
 380                  i_unreached();
 381          ext = array_idx(&map->extensions, ext_map_idx);
 382   
 383          /* get the current highest_modseq. don't change any modseq below it. */
 384          hdr = CONST_PTR_OFFSET(map->hdr_base, ext->hdr_offset);
 385          ctx->highest_modseq = hdr->highest_modseq;
 386   
 387          /* Scan logs for updates between ext_hdr.log_* .. view position.
 388             There are two reasons why there could be any:
 389   
 390             1) We just enabled modseqs and we're filling the initial values.
 391             2) A non-modseq-aware Dovecot version added new messages and wrote 
 392                dovecot.index file. */
 393          mail_transaction_log_view_get_prev_pos(ctx->view->log_view,
 394                                                 &end_seq, &end_offset);
 395          if (end_seq <= hdr->log_seq ||
 396              (end_seq == hdr->log_seq && end_offset <= hdr->log_offset)) {
 397                  /* modseqs are up to date */
 398                  return;
 399          }
 400   
 401          ctx->log_view = mail_transaction_log_view_open(ctx->view->index->log);
 402          ret = mail_transaction_log_view_set(ctx->log_view,
 403                                              I_MAX(1, hdr->log_seq),
 404                                              hdr->log_offset,
 405                                              end_seq, end_offset, &reset);
 406          if (ret == 0) {
 407                  /* missing files - try with only the last file */
 408                  ret = mail_transaction_log_view_set(ctx->log_view, end_seq, 0,
 409                                                      end_seq, end_offset,
 410                                                      &reset);
 411                  /* since we don't know if we skipped some changes, set all
 412                     modseqs to beginning of the latest file. */
 413                  cur_modseq = mail_transaction_log_view_get_prev_modseq(
 414                                                                  ctx->log_view);
 415                  if (cur_modseq < hdr->highest_modseq) {
 416                          /* should happen only when setting initial modseqs.
 417                             we may already have returned highest_modseq as
 418                             some messages' modseq value. don't shrink it. */
 419                          cur_modseq = hdr->highest_modseq;
 420                  }
 421                  mail_index_modseq_update(ctx, cur_modseq, TRUE, 1,
 422                                           map->hdr.messages_count);
 423          } else {
 424                  /* we have all the logs. replace zero modseqs with the current
 425                     highest modseq (we may have already returned it for them). */
 426                  mail_index_modseq_update(ctx, hdr->highest_modseq, FALSE, 1,
 427                                           map->hdr.messages_count);
 428          }
 429          if (ret > 0) {
 430                  while (mail_transaction_log_view_next(ctx->log_view,
 431                                                        &thdr, &tdata) > 0) {
 432                          T_BEGIN {
 433                                  mail_index_modseq_update_old_rec(ctx, thdr,
 434                                                                   tdata);
 435                          } T_END;
 436                  }
 437          }
 438          mail_index_sync_write_seq_update(ctx->sync_map_ctx, 1,
 439                                           map->hdr.messages_count);
 440          mail_transaction_log_view_close(&ctx->log_view);
 441  }
Show more  




Change Warning 7210.25734 : Unreachable Conditional

Priority:
State:
Finding:
Owner:
Note: