summaryrefslogtreecommitdiff
path: root/runtime/librsgt.c
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2014-10-01 17:56:20 +0400
committerIgor Pashev <pashev.igor@gmail.com>2014-10-01 17:56:20 +0400
commitc046f7bcc92281465917e026f83fd0d38569cb06 (patch)
tree711f61cf319e171a5f41c469ef30e3298c8917f8 /runtime/librsgt.c
parent17262528e2277c3d069c4a29ed098830d4fdbc08 (diff)
parent7ec8c6d6f9114765775ea5100af5b0b20af4502e (diff)
downloadrsyslog-c046f7bcc92281465917e026f83fd0d38569cb06.tar.gz
Merge branch 'master' of git://anonscm.debian.org/collab-maint/rsyslog
Conflicts: debian/changelog debian/patches/series debian/rules
Diffstat (limited to 'runtime/librsgt.c')
-rw-r--r--runtime/librsgt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/runtime/librsgt.c b/runtime/librsgt.c
index ae0b0df..f824749 100644
--- a/runtime/librsgt.c
+++ b/runtime/librsgt.c
@@ -75,7 +75,7 @@ reportGTAPIErr(gtctx ctx, gtfile gf, char *apiname, int ecode)
char errbuf[4096];
snprintf(errbuf, sizeof(errbuf), "%s[%s:%d]: %s",
(gf == NULL) ? (uchar*)"" : gf->sigfilename,
- apiname, ecode, GT_getErrorString(ecode));
+ apiname, ecode, GTHTTP_getErrorString(ecode));
errbuf[sizeof(errbuf)-1] = '\0';
reportErr(ctx, errbuf);
}
@@ -285,7 +285,9 @@ int
tlv8Write(gtfile gf, int flags, int tlvtype, int len)
{
int r;
- r = tlvbufAddOctet(gf, (flags << 5)|tlvtype);
+ assert((flags & RSGT_TYPE_MASK) == 0);
+ assert((tlvtype & RSGT_TYPE_MASK) == tlvtype);
+ r = tlvbufAddOctet(gf, (flags & ~RSGT_FLAG_TLV16) | tlvtype);
if(r != 0) goto done;
r = tlvbufAddOctet(gf, len & 0xff);
done: return r;
@@ -296,7 +298,9 @@ tlv16Write(gtfile gf, int flags, int tlvtype, uint16_t len)
{
uint16_t typ;
int r;
- typ = ((flags|1) << 13)|tlvtype;
+ assert((flags & RSGT_TYPE_MASK) == 0);
+ assert((tlvtype >> 8 & RSGT_TYPE_MASK) == (tlvtype >> 8));
+ typ = ((flags | RSGT_FLAG_TLV16) << 8) | tlvtype;
r = tlvbufAddOctet(gf, typ >> 8);
if(r != 0) goto done;
r = tlvbufAddOctet(gf, typ & 0xff);
@@ -402,6 +406,7 @@ readStateFile(gtfile gf)
free(gf->blkStrtHash);
goto err;
}
+ close(fd);
return;
err: