(/home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib-storage/index/dbox/dbox-index.c) |
| |
| 572 | | | static int dbox_index_recreate(struct dbox_index *index, bool locked) |
| 573 | | | { |
| 574 | | | struct mail_storage *storage = &index->mbox->storage->storage; |
| 575 | | | struct dbox_index_record *records; |
| 576 | | | struct ostream *output; |
| 577 | | | struct hdr; |
| 578 | | | string_t *temp_path, *str; |
| 579 | | | unsigned int i, count; |
| 580 | | | int fd, ret = 0; |
| 581 | | | |
| 582 | [+] | | temp_path = t_str_new(256); |
 |
| 583 | | | str_append(temp_path, index->path); |
| 584 | | | |
| 585 | [+] | | fd = dbox_index_create_fd(index->mbox, temp_path, locked); |
 |
| 586 | | | if (fd == -1) |
Event 14:
Skipping " if". fd == -1 evaluates to false.
hide
|
|
| 587 | | | return -1; |
| 588 | | | |
| 589 | | | str = t_str_new(256); |
| 590 | | | output = o_stream_create_fd_file(fd, 0, FALSE); |
| 591 | | | o_stream_cork(output); |
| 592 | | | |
| 593 | | | (index, &hdr); |
| 594 | | | o_stream_send(output, &hdr, sizeof(hdr)); |
| 595 | | | o_stream_send(output, "\n", 1); |
| 596 | | | |
| 597 | [+] | | records = array_get_modifiable(&index->records, &count);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
174 | #define array_get_modifiable(array, count) \ |
175 | ARRAY_TYPE_CAST_MODIFIABLE(array) \ |
176 | array_get_modifiable_i(&(array)->arr, count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
45 | # define ARRAY_TYPE_CAST_MODIFIABLE(array) \ |
46 | (typeof(*(array)->v_modifiable)) |
| |
|
 |
| 598 | | | for (i = 0; i < count; ) { |
Event 15:
Leaving loop. i < count evaluates to false.
hide
|
|
| 599 | | | if (records[i].status == DBOX_INDEX_FILE_STATUS_UNLINKED) { |
| 600 | | | array_delete(&index->records, i, 1);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
147 | #define array_delete(array, idx, count) \ |
148 | array_delete_i(&(array)->arr, idx, count) |
| |
|
| 601 | | | records = array_get_modifiable(&index->records, &count);
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
174 | #define array_get_modifiable(array, count) \ |
175 | ARRAY_TYPE_CAST_MODIFIABLE(array) \ |
176 | array_get_modifiable_i(&(array)->arr, count) |
| |
x /home/sate/Testcases/c/cve/dovecot-1.2.0/src/lib/array.h |
| |
45 | # define ARRAY_TYPE_CAST_MODIFIABLE(array) \ |
46 | (typeof(*(array)->v_modifiable)) |
| |
|
| 602 | | | } else { |
| 603 | | | records[i].file_offset = output->offset; |
| 604 | | | str_truncate(str, 0); |
| 605 | | | dbox_index_append_record(&records[i], str); |
| 606 | | | o_stream_send(output, str_data(str), str_len(str)); |
| 607 | | | i++; |
| 608 | | | } |
| 609 | | | } |
| 610 | | | |
| 611 | [+] | | if (o_stream_flush(output) < 0) { |
 |
| 612 | | | mail_storage_set_critical(storage, |
| 613 | | | "write(%s) failed: %m", str_c(temp_path)); |
| 614 | | | ret = -1; |
| 615 | | | } |
| 616 | | | |
| 617 | | | o_stream_destroy(&output); |
| 618 | | | if (ret == 0 && index->mbox->ibox.fsync_disable) { |
| 619 | | | if (fdatasync(fd) < 0) { |
Event 25:
Skipping " if". fdatasync(fd) < 0 evaluates to false.
hide
|
|
| 620 | | | mail_storage_set_critical(storage, |
| 621 | | | "fdatasync(%s) failed: %m", str_c(temp_path)); |
| 622 | | | ret = -1; |
| 623 | | | } |
| 624 | | | } |
| 625 | | | if (close(fd) < 0) { |
Event 26:
Skipping " if". close(fd) < 0 evaluates to false.
hide
|
|
| 626 | | | mail_storage_set_critical(storage, |
| 627 | | | "close(%s) failed: %m", str_c(temp_path)); |
| 628 | | | ret = -1; |
| 629 | | | } |
| 630 | | | if (ret == 0) { |
Event 27:
Taking true branch. ret == 0 evaluates to true.
hide
|
|
| 631 | | | if (locked) { |
Event 28:
Taking false branch. locked evaluates to false.
hide
|
|
| 632 | | | if (rename(str_c(temp_path), index->path) < 0) { |
| 633 | | | mail_storage_set_critical(storage, |
| 634 | | | "rename(%s, %s) failed: %m", |
| 635 | | | str_c(temp_path), index->path); |
| 636 | | | ret = -1; |
| 637 | | | } |
| 638 | | | } else { |
| 639 | [+] | | if (nfs_safe_link(str_c(temp_path), index->path, |
Event 30:
temp_path, which evaluates to the value assigned to buf at buffer.c:116, is passed to str_c(). See related event 6.
hide
|
|
 |
| 640 | [+] | | TRUE) < 0 && |
Event 29:
Skipping " if". !0 evaluates to true.
hide
|
|
 |
| 641 | | | errno != EEXIST) { |
| 642 | | | mail_storage_set_critical(storage, |
| 643 | | | "link(%s, %s) failed: %m", |
| 644 | | | str_c(temp_path), index->path); |
| 645 | | | ret = -1; |
| 646 | | | } |
| 647 | | | } |
| 648 | | | } |
| 649 | | | if (ret < 0 || !locked) { |
| 650 | [+] | | if (unlink(str_c(temp_path)) < 0) |
Event 47:
temp_path, which evaluates to the value assigned to buf at buffer.c:116, is passed to str_c(). See related event 6.
hide
|
|
 |
| |