]> granicus.if.org Git - sudo/commitdiff
Don't print an error message in yyerror() if open_sudoers() fails,
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 23 Aug 2012 18:21:04 +0000 (14:21 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 23 Aug 2012 18:21:04 +0000 (14:21 -0400)
we've already printed an error message.

--HG--
branch : 1.7

toke.c
toke.l

diff --git a/toke.c b/toke.c
index cdf194ef352e1e050512a4b28d8d2eaed8d70829..8dc3572a3cf794f5cebc952493f10a778060f204 100644 (file)
--- 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 0f6d358cc01b32b0c8d5b7a9526a50c046e28f80..151438835e93bbb97719520872b5853695f41545 100644 (file)
--- 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;