dovecot-2.1: dict file: Don't ignore write failures.
dovecot at dovecot.org
dovecot at dovecot.org
Sun Jun 24 19:44:28 EEST 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/cc6d2b34965d
changeset: 14574:cc6d2b34965d
user: Timo Sirainen <tss at iki.fi>
date: Sun Jun 24 19:44:22 2012 +0300
description:
dict file: Don't ignore write failures.
diffstat:
src/lib-dict/dict-file.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diffs (37 lines):
diff -r 7be9411da17b -r cc6d2b34965d src/lib-dict/dict-file.c
--- a/src/lib-dict/dict-file.c Sun Jun 24 03:19:17 2012 +0300
+++ b/src/lib-dict/dict-file.c Sun Jun 24 19:44:22 2012 +0300
@@ -492,7 +492,7 @@
/* refresh once more now that we're locked */
if (file_dict_refresh(dict) < 0) {
if (dotlock != NULL)
- file_dotlock_delete(&dotlock);
+ (void)file_dotlock_delete(&dotlock);
else {
(void)close(fd);
file_unlock(&lock);
@@ -512,12 +512,20 @@
o_stream_cork(output);
iter = hash_table_iterate_init(dict->hash);
while (hash_table_iterate(iter, &key, &value)) {
- o_stream_send_str(output, key);
- o_stream_send(output, "\n", 1);
- o_stream_send_str(output, value);
- o_stream_send(output, "\n", 1);
+ (void)o_stream_send_str(output, key);
+ (void)o_stream_send(output, "\n", 1);
+ (void)o_stream_send_str(output, value);
+ (void)o_stream_send(output, "\n", 1);
}
+ o_stream_uncork(output);
hash_table_iterate_deinit(&iter);
+
+ if (output->stream_errno != 0) {
+ i_error("write(%s) failed: %m", temp_path);
+ o_stream_destroy(&output);
+ (void)close(fd);
+ return -1;
+ }
o_stream_destroy(&output);
if (dotlock != NULL) {
More information about the dovecot-cvs
mailing list