summaryrefslogtreecommitdiffstats
path: root/usr.sbin/hostapd
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2014-11-03 16:57:50 +0000
committerbluhm <bluhm@openbsd.org>2014-11-03 16:57:50 +0000
commit2f94bf7fba626abc848e0da7f780a9cea09d8397 (patch)
tree89e65f284c7056c51f4c001d3d46dcf3c793657c /usr.sbin/hostapd
parentConvert the logic in yyerror(). Instead of creating a temporary (diff)
downloadwireguard-openbsd-2f94bf7fba626abc848e0da7f780a9cea09d8397.tar.xz
wireguard-openbsd-2f94bf7fba626abc848e0da7f780a9cea09d8397.zip
Convert the logic in yyerror(). Instead of creating a temporary
format string, create a temporary message. OK benno@ doug@
Diffstat (limited to 'usr.sbin/hostapd')
-rw-r--r--usr.sbin/hostapd/parse.y15
1 files changed, 7 insertions, 8 deletions
diff --git a/usr.sbin/hostapd/parse.y b/usr.sbin/hostapd/parse.y
index 4914b7b45cd..d52dcc9ce90 100644
--- a/usr.sbin/hostapd/parse.y
+++ b/usr.sbin/hostapd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.45 2014/01/22 00:21:16 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.46 2014/11/03 16:57:50 bluhm Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Reyk Floeter <reyk@openbsd.org>
@@ -1779,18 +1779,17 @@ int
yyerror(const char *fmt, ...)
{
va_list ap;
- char *nfmt;
+ char *msg;
file->errors++;
va_start(ap, fmt);
- if (asprintf(&nfmt, "%s:%d: %s\n", file->name, yylval.lineno,
- fmt) == -1)
- hostapd_fatal("yyerror asprintf");
- vfprintf(stderr, nfmt, ap);
- fflush(stderr);
+ if (vasprintf(&msg, fmt, ap) == -1)
+ hostapd_fatal("yyerror vasprintf");
va_end(ap);
- free(nfmt);
+ fprintf(stderr, "%s:%d: %s\n", file->name, yylval.lineno, msg);
+ fflush(stderr);
+ free(msg);
return (0);
}