diff --git a/plugins/sudoers/gram.c b/plugins/sudoers/gram.c index 7b6044fd0..66bccad86 100644 --- a/plugins/sudoers/gram.c +++ b/plugins/sudoers/gram.c @@ -3344,10 +3344,7 @@ sudoerserrorf(const char *fmt, ...) sudoers_setlocale(SUDOERS_LOCALE_USER, &oldlocale); va_start(ap, fmt); - if (sudoerschar == ERROR) { - /* Use error string from lexer. */ - s = _(sudoers_errstr); - } else if (strcmp(fmt, "%s") == 0) { + if (strcmp(fmt, "%s") == 0) { /* Optimize common case, a single string. */ s = _(va_arg(ap, char *)); } else { @@ -3389,6 +3386,12 @@ sudoerserrorf(const char *fmt, ...) void sudoerserror(const char *s) { + if (sudoerschar == ERROR) { + /* Use error string from lexer. */ + s = sudoers_errstr; + sudoers_errstr = NULL; + } + // -V:sudoerserror:575, 618 if (s == NULL) sudoerserrorf(NULL); diff --git a/plugins/sudoers/gram.y b/plugins/sudoers/gram.y index 6a4d8fa22..63bb5adff 100644 --- a/plugins/sudoers/gram.y +++ b/plugins/sudoers/gram.y @@ -1188,10 +1188,7 @@ sudoerserrorf(const char *fmt, ...) sudoers_setlocale(SUDOERS_LOCALE_USER, &oldlocale); va_start(ap, fmt); - if (sudoerschar == ERROR) { - /* Use error string from lexer. */ - s = _(sudoers_errstr); - } else if (strcmp(fmt, "%s") == 0) { + if (strcmp(fmt, "%s") == 0) { /* Optimize common case, a single string. */ s = _(va_arg(ap, char *)); } else { @@ -1233,6 +1230,12 @@ sudoerserrorf(const char *fmt, ...) void sudoerserror(const char *s) { + if (sudoerschar == ERROR) { + /* Use error string from lexer. */ + s = sudoers_errstr; + sudoers_errstr = NULL; + } + // -V:sudoerserror:575, 618 if (s == NULL) sudoerserrorf(NULL);