From 3952271445403120f080dc663aba68d320edcd45 Mon Sep 17 00:00:00 2001 From: Fredrik Tolf Date: Thu, 27 Feb 2014 07:44:50 +0100 Subject: [PATCH] accesslog: Fixed non-ASCII logging bug again. --- src/accesslog.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/accesslog.c b/src/accesslog.c index f17eebe..88b61b3 100644 --- a/src/accesslog.c +++ b/src/accesslog.c @@ -46,8 +46,10 @@ static char *format; static struct timeval now; static volatile int reopen = 0; -static void qputs(char *s, FILE *o) +static void qputs(char *sp, FILE *o) { + unsigned char *s = (unsigned char *)sp; + for(; *s; s++) { if(*s == '\"') { fputs("\\\"", o); @@ -58,7 +60,7 @@ static void qputs(char *s, FILE *o) } else if(*s == '\t') { fputs("\\t", o); } else if((*s < 32) || (*s >= 128)) { - fprintf(o, "\\x%02x", (int)(unsigned char)*s); + fprintf(o, "\\x%02x", (int)*s); } else { fputc(*s, o); } -- 2.11.0