Minor warning/error cleanup

This commit is contained in:
Todd C. Miller
2011-05-18 13:44:36 -04:00
parent 0954a1b1c0
commit 42a3966a88
7 changed files with 14 additions and 13 deletions

View File

@@ -240,9 +240,9 @@ cleanup:
flags = 0; flags = 0;
else else
flags = NO_MAIL; flags = NO_MAIL;
log_error(flags, _("%d incorrect password attempt%s"), log_error(flags, ngettext("%d incorrect password attempt",
def_passwd_tries - counter, "%d incorrect password attempts",
(def_passwd_tries - counter == 1) ? "" : "s"); def_passwd_tries - counter), def_passwd_tries - counter);
} }
audit_failure(NewArgv, "authentication failure"); audit_failure(NewArgv, "authentication failure");
rval = FALSE; rval = FALSE;

View File

@@ -286,7 +286,7 @@ sudo_putenv(char *str, int dupcheck, int overwrite)
#ifdef ENV_DEBUG #ifdef ENV_DEBUG
if (env.envp[env.env_len] != NULL) if (env.envp[env.env_len] != NULL)
errorx(1, _("sudo_putenv: corrupted envp, len mismatch")); errorx(1, _("sudo_putenv: corrupted envp, length mismatch"));
#endif #endif
if (dupcheck) { if (dupcheck) {

View File

@@ -42,6 +42,7 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif /* HAVE_UNISTD_H */ #endif /* HAVE_UNISTD_H */
#include <errno.h>
#include "sudoers.h" #include "sudoers.h"
@@ -64,7 +65,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path,
int len; /* length parameter */ int len; /* length parameter */
if (strlen(infile) >= PATH_MAX) 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 * 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); len = snprintf(command, sizeof(command), "%s/%s", path, infile);
if (len <= 0 || len >= sizeof(command)) 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))) if ((result = sudo_goodpath(command, sbp)))
break; break;
@@ -118,7 +119,7 @@ find_path(char *infile, char **outfile, struct stat *sbp, char *path,
if (!result && checkdot) { if (!result && checkdot) {
len = snprintf(command, sizeof(command), "./%s", infile); len = snprintf(command, sizeof(command), "./%s", infile);
if (len <= 0 || len >= sizeof(command)) 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); result = sudo_goodpath(command, sbp);
if (result && ignore_dot) if (result && ignore_dot)
return NOT_FOUND_DOT; return NOT_FOUND_DOT;

View File

@@ -104,7 +104,7 @@ group_plugin_load(char *plugin_info)
goto done; goto done;
} }
if ((sb.st_mode & (S_IWGRP|S_IWOTH)) != 0) { 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; goto done;
} }

View File

@@ -867,7 +867,7 @@ set_cmnd(int sudo_mode)
} }
} }
if (strlen(user_cmnd) >= PATH_MAX) 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) if ((user_base = strrchr(user_cmnd, '/')) != NULL)
user_base++; user_base++;
@@ -979,7 +979,7 @@ set_loginclass(struct passwd *pw)
if (login_class && strcmp(login_class, "-") != 0) { if (login_class && strcmp(login_class, "-") != 0) {
if (user_uid != 0 && if (user_uid != 0 &&
strcmp(runas_user ? runas_user : def_runas_default, "root") != 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 { } else {
login_class = pw->pw_class; login_class = pw->pw_class;
if (!login_class || !*login_class) if (!login_class || !*login_class)

View File

@@ -578,7 +578,7 @@ parse_expr(struct search_node **headp, char *argv[])
#ifdef HAVE_REGCOMP #ifdef HAVE_REGCOMP
if (type == ST_PATTERN) { if (type == ST_PATTERN) {
if (regcomp(&newsn->u.cmdre, *av, REG_EXTENDED|REG_NOSUB) != 0) 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 } else
#endif #endif
if (type == ST_TODATE || type == ST_FROMDATE) { if (type == ST_TODATE || type == ST_FROMDATE) {

View File

@@ -210,7 +210,7 @@ main(int argc, char *argv[])
/* Mock up a fake sudo_user struct. */ /* Mock up a fake sudo_user struct. */
user_cmnd = ""; user_cmnd = "";
if ((sudo_user.pw = sudo_getpwuid(getuid())) == NULL) 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(); get_hostname();
/* Setup defaults data structures. */ /* Setup defaults data structures. */
@@ -670,7 +670,7 @@ run_command(char *path, char **argv)
switch (pid = fork()) { switch (pid = fork()) {
case -1: case -1:
error(1, _("unable to run %s"), path); error(1, _("unable to execute %s"), path);
break; /* NOTREACHED */ break; /* NOTREACHED */
case 0: case 0:
sudo_endpwent(); sudo_endpwent();