dovecot-2.2: dict-cdb: Handle cdb_read() errors.
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jan 21 18:34:00 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/87a709eb7b28
changeset: 15666:87a709eb7b28
user: Timo Sirainen <tss at iki.fi>
date: Mon Jan 21 18:33:55 2013 +0200
description:
dict-cdb: Handle cdb_read() errors.
diffstat:
src/lib-dict/dict-cdb.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (26 lines):
diff -r 2c249941f9c2 -r 87a709eb7b28 src/lib-dict/dict-cdb.c
--- a/src/lib-dict/dict-cdb.c Mon Jan 21 18:31:08 2013 +0200
+++ b/src/lib-dict/dict-cdb.c Mon Jan 21 18:33:55 2013 +0200
@@ -102,7 +102,7 @@
*value_r = NULL;
/* something bad with db */
if (ret < 0) {
- i_error("cdb_lookup(%s) failed: %m", dict->path);
+ i_error("cdb_find(%s) failed: %m", dict->path);
return -1;
}
/* found nothing */
@@ -110,8 +110,11 @@
}
datalen = cdb_datalen(&dict->cdb);
- data = p_new(pool, char, datalen + 1);
- cdb_read(&dict->cdb, data, datalen, cdb_datapos(&dict->cdb));
+ data = p_malloc(pool, datalen + 1);
+ if (cdb_read(&dict->cdb, data, datalen, cdb_datapos(&dict->cdb)) < 0) {
+ i_error("cdb_read(%s) failed: %m", dict->path);
+ return -1;
+ }
*value_r = data;
return 1;
}
More information about the dovecot-cvs
mailing list