From: Todd C. Miller Date: Wed, 18 May 2011 17:44:36 +0000 (-0400) Subject: Minor warning/error cleanup X-Git-Tag: SUDO_1_8_2~139^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=42a3966a88c168eaa4ffc197b2156a72d9a9f279;p=sudo Minor warning/error cleanup --- diff --git a/plugins/sudoers/auth/sudo_auth.c b/plugins/sudoers/auth/sudo_auth.c index 58ba3ec2b..f82b5cb7f 100644 --- a/plugins/sudoers/auth/sudo_auth.c +++ b/plugins/sudoers/auth/sudo_auth.c @@ -240,9 +240,9 @@ cleanup: flags = 0; else flags = NO_MAIL; - log_error(flags, _("%d incorrect password attempt%s"), - def_passwd_tries - counter, - (def_passwd_tries - counter == 1) ? "" : "s"); + log_error(flags, ngettext("%d incorrect password attempt", + "%d incorrect password attempts", + def_passwd_tries - counter), def_passwd_tries - counter); } audit_failure(NewArgv, "authentication failure"); rval = FALSE; diff --git a/plugins/sudoers/env.c b/plugins/sudoers/env.c index f4fd9d1db..3e713fd65 100644 --- a/plugins/sudoers/env.c +++ b/plugins/sudoers/env.c @@ -286,7 +286,7 @@ sudo_putenv(char *str, int dupcheck, int overwrite) #ifdef ENV_DEBUG if (env.envp[env.env_len] != NULL) - errorx(1, _("sudo_putenv: corrupted envp, len mismatch")); + errorx(1, _("sudo_putenv: corrupted envp, length mismatch")); #endif if (dupcheck) { diff --git a/plugins/sudoers/find_path.c b/plugins/sudoers/find_path.c index 63ec3fe9c..4064248e3 100644 --- a/plugins/sudoers/find_path.c +++ b/plugins/sudoers/find_path.c @@ -42,6 +42,7 @@ #ifdef HAVE_UNISTD_H # include #endif /* HAVE_UNISTD_H */ +#include #include "sudoers.h" @@ -64,7 +65,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path, int len; /* length parameter */ if (strlen(infile) >= PATH_MAX) - errorx(1, _("%s: File name too long"), infile); + errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG)); /* * If we were given a fully qualified or relative path @@ -103,7 +104,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path, */ len = snprintf(command, sizeof(command), "%s/%s", path, infile); if (len <= 0 || len >= sizeof(command)) - errorx(1, _("%s: File name too long"), infile); + errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG)); if ((result = sudo_goodpath(command, sbp))) break; @@ -118,7 +119,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path, if (!result && checkdot) { len = snprintf(command, sizeof(command), "./%s", infile); if (len <= 0 || len >= sizeof(command)) - errorx(1, _("%s: File name too long"), infile); + errorx(1, _("%s: %s"), infile, strerror(ENAMETOOLONG)); result = sudo_goodpath(command, sbp); if (result && ignore_dot) return NOT_FOUND_DOT; diff --git a/plugins/sudoers/group_plugin.c b/plugins/sudoers/group_plugin.c index 8f40af6b7..2bc536cbc 100644 --- a/plugins/sudoers/group_plugin.c +++ b/plugins/sudoers/group_plugin.c @@ -104,7 +104,7 @@ group_plugin_load(char *plugin_info) goto done; } if ((sb.st_mode & (S_IWGRP|S_IWOTH)) != 0) { - warningx(_("%s must be only be writable by owner"), path); + warningx(_("%s must only be writable by owner"), path); goto done; } diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c index efd4078a2..f639d1e25 100644 --- a/plugins/sudoers/sudoers.c +++ b/plugins/sudoers/sudoers.c @@ -867,7 +867,7 @@ set_cmnd(int sudo_mode) } } if (strlen(user_cmnd) >= PATH_MAX) - errorx(1, _("%s: file name too long"), user_cmnd); + errorx(1, _("%s: %s"), user_cmnd, strerror(ENAMETOOLONG)); if ((user_base = strrchr(user_cmnd, '/')) != NULL) user_base++; @@ -979,7 +979,7 @@ set_loginclass(struct passwd *pw) if (login_class && strcmp(login_class, "-") != 0) { if (user_uid != 0 && strcmp(runas_user ? runas_user : def_runas_default, "root") != 0) - errorx(1, _("only root can use -c %s"), login_class); + errorx(1, _("only root can use `-c %s'"), login_class); } else { login_class = pw->pw_class; if (!login_class || !*login_class) diff --git a/plugins/sudoers/sudoreplay.c b/plugins/sudoers/sudoreplay.c index 6cada297b..828cf341e 100644 --- a/plugins/sudoers/sudoreplay.c +++ b/plugins/sudoers/sudoreplay.c @@ -578,7 +578,7 @@ parse_expr(struct search_node **headp, char *argv[]) #ifdef HAVE_REGCOMP if (type == ST_PATTERN) { if (regcomp(&newsn->u.cmdre, *av, REG_EXTENDED|REG_NOSUB) != 0) - errorx(1, _("invalid regex: %s"), *av); + errorx(1, _("invalid regular expression: %s"), *av); } else #endif if (type == ST_TODATE || type == ST_FROMDATE) { diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index 6963c8a97..49e87f7b2 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -210,7 +210,7 @@ main(int argc, char *argv[]) /* Mock up a fake sudo_user struct. */ user_cmnd = ""; if ((sudo_user.pw = sudo_getpwuid(getuid())) == NULL) - errorx(1, _("you don't exist in the passwd database")); + errorx(1, _("you do not exist in the %s database"), "passwd"); get_hostname(); /* Setup defaults data structures. */ @@ -670,7 +670,7 @@ run_command(char *path, char **argv) switch (pid = fork()) { case -1: - error(1, _("unable to run %s"), path); + error(1, _("unable to execute %s"), path); break; /* NOTREACHED */ case 0: sudo_endpwent();