From 59386e3cf60e1faa2ec8e8344d73f12a13dd13f5 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 23 Aug 2012 14:21:04 -0400 Subject: [PATCH] Don't print an error message in yyerror() if open_sudoers() fails, we've already printed an error message. --HG-- branch : 1.7 --- toke.c | 11 +++-------- toke.l | 9 ++------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/toke.c b/toke.c index cdf194ef3..8dc3572a3 100644 --- a/toke.c +++ b/toke.c @@ -4,7 +4,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvs/src/usr.bin/lex/flex.skl,v 1.11 2010/08/04 18:24:50 millert Exp $ + * $Header: /home/cvs/openbsd/src/usr.bin/lex/flex.skl,v 1.11 2010/08/04 18:24:50 millert Exp $ */ #define FLEX_SCANNER @@ -3571,13 +3571,8 @@ _push_include(path, isdir) } } else { if ((fp = open_sudoers(path, TRUE, &keepopen)) == NULL) { - char *errbuf; - if (asprintf(&errbuf, "%s: %s", path, strerror(errno)) != -1) { - yyerror(errbuf); - free(errbuf); - } else { - yyerror("unable to allocate memory"); - } + /* The error was already printed by open_sudoers() */ + yyerror(NULL); return FALSE; } istack[idepth].more = NULL; diff --git a/toke.l b/toke.l index 0f6d358cc..151438835 100644 --- a/toke.l +++ b/toke.l @@ -862,13 +862,8 @@ _push_include(path, isdir) } } else { if ((fp = open_sudoers(path, TRUE, &keepopen)) == NULL) { - char *errbuf; - if (asprintf(&errbuf, "%s: %s", path, strerror(errno)) != -1) { - yyerror(errbuf); - free(errbuf); - } else { - yyerror("unable to allocate memory"); - } + /* The error was already printed by open_sudoers() */ + yyerror(NULL); return FALSE; } istack[idepth].more = NULL; -- 2.40.0