diff options
author | 2014-11-03 18:43:24 +0000 | |
---|---|---|
committer | 2014-11-03 18:43:24 +0000 | |
commit | 7d191ae95884e54ea274fddbbd5b2cb7fe816322 (patch) | |
tree | 075a6b83c3229f161884fd0596c37389697eefae | |
parent | Eliminate RTLD_PROTECT_PLT: ld.so is built with -Bsymbolic so the (diff) | |
download | wireguard-openbsd-7d191ae95884e54ea274fddbbd5b2cb7fe816322.tar.xz wireguard-openbsd-7d191ae95884e54ea274fddbbd5b2cb7fe816322.zip |
Convert the logic in yyerror(). Instead of creating a temporary
format string, create a temporary message.
OK deraadt@
-rw-r--r-- | usr.sbin/httpd/httpd.h | 3 | ||||
-rw-r--r-- | usr.sbin/httpd/parse.y | 12 |
2 files changed, 8 insertions, 7 deletions
diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h index 76cabf015d8..1b43a2e36f9 100644 --- a/usr.sbin/httpd/httpd.h +++ b/usr.sbin/httpd/httpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.h,v 1.61 2014/10/31 13:49:52 jsing Exp $ */ +/* $OpenBSD: httpd.h,v 1.62 2014/11/03 18:43:24 bluhm Exp $ */ /* * Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org> @@ -587,6 +587,7 @@ void log_warn(const char *, ...) __attribute__((__format__ (printf, 1, 2))); void log_warnx(const char *, ...) __attribute__((__format__ (printf, 1, 2))); void log_info(const char *, ...) __attribute__((__format__ (printf, 1, 2))); void log_debug(const char *, ...) __attribute__((__format__ (printf, 1, 2))); +void logit(int, const char *, ...) __attribute__((__format__ (printf, 2, 3))); void vlog(int, const char *, va_list) __attribute__((__format__ (printf, 2, 0))); __dead void fatal(const char *); __dead void fatalx(const char *); diff --git a/usr.sbin/httpd/parse.y b/usr.sbin/httpd/parse.y index e3790ef6609..69f0b4b8de1 100644 --- a/usr.sbin/httpd/parse.y +++ b/usr.sbin/httpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.39 2014/11/03 03:46:44 doug Exp $ */ +/* $OpenBSD: parse.y,v 1.40 2014/11/03 18:43:24 bluhm Exp $ */ /* * Copyright (c) 2007 - 2014 Reyk Floeter <reyk@openbsd.org> @@ -827,15 +827,15 @@ int yyerror(const char *fmt, ...) { va_list ap; - char *nfmt; + char *msg; file->errors++; va_start(ap, fmt); - if (asprintf(&nfmt, "%s:%d: %s", file->name, yylval.lineno, fmt) == -1) - fatalx("yyerror asprintf"); - vlog(LOG_CRIT, nfmt, ap); + if (vasprintf(&msg, fmt, ap) == -1) + fatalx("yyerror vasprintf"); va_end(ap); - free(nfmt); + logit(LOG_CRIT, "%s:%d: %s", file->name, yylval.lineno, msg); + free(msg); return (0); } |