Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

LogProto: fixed a bug in fixed-size-encoding detection

Due to a typo, fixed-size encodings were not properly recognized, causing
syslog-ng to use the slow-path in case encoding() was used on a source.

This change fixes that issue, and at the same time publishes the function
log_proto_get_char_size_for_fixed_encoding() so that its unit test can call
it directly.

Cc: <syslog-ng-stable@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
  • Loading branch information...
commit bc72d5997f3e1125466960b972e4965b74d183df 1 parent adf5939
Balazs Scheidler bazsi authored committed
Showing with 3 additions and 2 deletions.
  1. +2 −2 lib/logproto.c
  2. +1 −0  lib/logproto.h
4 lib/logproto.c
View
@@ -503,7 +503,7 @@ struct _LogProtoBufferedServer
* This function returns 0 if the encoding is not known, in which case the
* slow path is to be executed.
*/
-static gint
+gint
log_proto_get_char_size_for_fixed_encoding(const gchar *encoding)
{
static struct
@@ -531,7 +531,7 @@ log_proto_get_char_size_for_fixed_encoding(const gchar *encoding)
for (i = 0; fixed_encodings[i].prefix; i++)
{
- if (strncasecmp(encoding, fixed_encodings[i].prefix, strlen(fixed_encodings[i].prefix) == 0))
+ if (strncasecmp(encoding, fixed_encodings[i].prefix, strlen(fixed_encodings[i].prefix)) == 0)
{
scale = fixed_encodings[i].scale;
break;
1  lib/logproto.h
View
@@ -123,6 +123,7 @@ log_proto_reset_error(LogProto *s)
s->status = LPS_SUCCESS;
}
+gint log_proto_get_char_size_for_fixed_encoding(const gchar *encoding);
gboolean log_proto_set_encoding(LogProto *s, const gchar *encoding);
void log_proto_free(LogProto *s);
Please sign in to comment.
Something went wrong with that request. Please try again.