diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-10-13 13:39:50 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2013-10-13 13:56:37 +0300 |
commit | 58f7dbc0658b3d73816a1bc91b75c2bdac733510 (patch) | |
tree | 3d971a9b1a3fd25ca46588112c3a314f971d584f /src/binlog.c | |
parent | 23f262e8c6181465347c3bb47644f9d86fcb7432 (diff) | |
download | vmod-binlog-58f7dbc0658b3d73816a1bc91b75c2bdac733510.tar.gz vmod-binlog-58f7dbc0658b3d73816a1bc91b75c2bdac733510.tar.bz2 |
Fix error checking, add pack tests.
* src/binlog.c (vmod_init): Fix error checking after packcomp.
* src/binlogcat.c (catlog): Likewise.
* tests/binpack.c (main): Likewise.
* src/pack.c (Z_unpacker): Fix output format.
(packcomp): allow for whitespace between specifiers. On error
set errno and return NULL.
* tests/Makefile.am: Add pack.at
* tests/testsuite.at: Likewise.
* tests/pack.at: New file.
* tests/test02.at: Fix name pattern.
Diffstat (limited to 'src/binlog.c')
-rw-r--r-- | src/binlog.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/binlog.c b/src/binlog.c index 7e88817..765b945 100644 --- a/src/binlog.c +++ b/src/binlog.c | |||
@@ -220,9 +220,11 @@ vmod_init(struct sess *sp, struct vmod_priv *priv, | |||
220 | AN(conf->dir); | 220 | AN(conf->dir); |
221 | 221 | ||
222 | conf->inst_head = packcomp(dataspec, &p); | 222 | conf->inst_head = packcomp(dataspec, &p); |
223 | AN(conf->inst_head); | 223 | if (!conf->inst_head) { |
224 | if (*p) { | 224 | if (errno == EINVAL) |
225 | binlog_error("cannot compile data format near %s", p); | 225 | binlog_error("cannot compile data format near %s", p); |
226 | else | ||
227 | binlog_error("%s", strerror(errno)); | ||
226 | abort(); | 228 | abort(); |
227 | } | 229 | } |
228 | conf->recsize = packsize(conf->inst_head); | 230 | conf->recsize = packsize(conf->inst_head); |