Minor warning/error message cleanup
This commit is contained in:
@@ -222,17 +222,21 @@ update_timestamp(char *timestampdir, char *timestampfile)
|
||||
*/
|
||||
int fd = open(timestampfile, O_WRONLY|O_CREAT, 0600);
|
||||
if (fd == -1)
|
||||
log_error(NO_EXIT|USE_ERRNO, _("Can't open %s"), timestampfile);
|
||||
log_error(NO_EXIT|USE_ERRNO, _("unable to open %s"), timestampfile);
|
||||
else {
|
||||
lock_file(fd, SUDO_LOCK);
|
||||
if (write(fd, &tty_info, sizeof(tty_info)) != sizeof(tty_info))
|
||||
log_error(NO_EXIT|USE_ERRNO, _("Can't write %s"), timestampfile);
|
||||
if (write(fd, &tty_info, sizeof(tty_info)) != sizeof(tty_info)) {
|
||||
log_error(NO_EXIT|USE_ERRNO, _("unable to write to %s"),
|
||||
timestampfile);
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
} else {
|
||||
if (touch(-1, timestampdir, NULL) == -1) {
|
||||
if (mkdir(timestampdir, 0700) == -1)
|
||||
log_error(NO_EXIT|USE_ERRNO, _("Can't mkdir %s"), timestampdir);
|
||||
if (mkdir(timestampdir, 0700) == -1) {
|
||||
log_error(NO_EXIT|USE_ERRNO, _("unable to mkdir %s"),
|
||||
timestampdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (timestamp_uid != 0)
|
||||
|
@@ -119,7 +119,7 @@ mkdir_parents(char *path)
|
||||
*slash = '\0';
|
||||
if (stat(path, &sb) != 0) {
|
||||
if (mkdir(path, S_IRWXU) != 0)
|
||||
log_error(USE_ERRNO, _("Can't mkdir %s"), path);
|
||||
log_error(USE_ERRNO, _("unable to mkdir %s"), path);
|
||||
} else if (!S_ISDIR(sb.st_mode)) {
|
||||
log_error(0, _("%s: %s"), path, strerror(ENOTDIR));
|
||||
}
|
||||
@@ -150,7 +150,7 @@ io_nextid(char *iolog_dir, char sessid[7])
|
||||
mkdir_parents(iolog_dir);
|
||||
if (stat(iolog_dir, &sb) != 0) {
|
||||
if (mkdir(iolog_dir, S_IRWXU) != 0)
|
||||
log_error(USE_ERRNO, _("Can't mkdir %s"), iolog_dir);
|
||||
log_error(USE_ERRNO, _("unable to mkdir %s"), iolog_dir);
|
||||
} else if (!S_ISDIR(sb.st_mode)) {
|
||||
log_error(0, _("%s exists but is not a directory (0%o)"),
|
||||
iolog_dir, (unsigned int) sb.st_mode);
|
||||
@@ -196,7 +196,7 @@ io_nextid(char *iolog_dir, char sessid[7])
|
||||
|
||||
/* Rewind and overwrite old seq file. */
|
||||
if (lseek(fd, 0, SEEK_SET) == (off_t)-1 || write(fd, buf, 7) != 7)
|
||||
log_error(USE_ERRNO, _("Can't write to %s"), pathbuf);
|
||||
log_error(USE_ERRNO, _("unable to write to %s"), pathbuf);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
@@ -222,10 +222,10 @@ mkdir_iopath(const char *iolog_path, char *pathbuf, size_t pathsize)
|
||||
mkdir_parents(pathbuf);
|
||||
if (len >= 6 && strcmp(&pathbuf[len - 6], "XXXXXX") == 0) {
|
||||
if (mkdtemp(pathbuf) == NULL)
|
||||
log_error(USE_ERRNO, _("Can't create %s"), pathbuf);
|
||||
log_error(USE_ERRNO, _("unable to create %s"), pathbuf);
|
||||
} else {
|
||||
if (mkdir(pathbuf, S_IRWXU) != 0)
|
||||
log_error(USE_ERRNO, _("Can't create %s"), pathbuf);
|
||||
log_error(USE_ERRNO, _("unable to create %s"), pathbuf);
|
||||
}
|
||||
|
||||
return len;
|
||||
@@ -477,18 +477,18 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
|
||||
*/
|
||||
io_logfile = open_io_fd(pathbuf, len, "/log", FALSE);
|
||||
if (io_logfile == NULL)
|
||||
log_error(USE_ERRNO, _("Can't create %s"), pathbuf);
|
||||
log_error(USE_ERRNO, _("unable to create %s"), pathbuf);
|
||||
|
||||
io_fds[IOFD_TIMING].v = open_io_fd(pathbuf, len, "/timing",
|
||||
iolog_compress);
|
||||
if (io_fds[IOFD_TIMING].v == NULL)
|
||||
log_error(USE_ERRNO, _("Can't create %s"), pathbuf);
|
||||
log_error(USE_ERRNO, _("unable to create %s"), pathbuf);
|
||||
|
||||
if (details.iolog_ttyin) {
|
||||
io_fds[IOFD_TTYIN].v = open_io_fd(pathbuf, len, "/ttyin",
|
||||
iolog_compress);
|
||||
if (io_fds[IOFD_TTYIN].v == NULL)
|
||||
log_error(USE_ERRNO, _("Can't create %s"), pathbuf);
|
||||
log_error(USE_ERRNO, _("unable to create %s"), pathbuf);
|
||||
} else {
|
||||
sudoers_io.log_ttyin = NULL;
|
||||
}
|
||||
@@ -496,7 +496,7 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
|
||||
io_fds[IOFD_STDIN].v = open_io_fd(pathbuf, len, "/stdin",
|
||||
iolog_compress);
|
||||
if (io_fds[IOFD_STDIN].v == NULL)
|
||||
log_error(USE_ERRNO, _("Can't create %s"), pathbuf);
|
||||
log_error(USE_ERRNO, _("unable to create %s"), pathbuf);
|
||||
} else {
|
||||
sudoers_io.log_stdin = NULL;
|
||||
}
|
||||
@@ -504,7 +504,7 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
|
||||
io_fds[IOFD_TTYOUT].v = open_io_fd(pathbuf, len, "/ttyout",
|
||||
iolog_compress);
|
||||
if (io_fds[IOFD_TTYOUT].v == NULL)
|
||||
log_error(USE_ERRNO, _("Can't create %s"), pathbuf);
|
||||
log_error(USE_ERRNO, _("unable to create %s"), pathbuf);
|
||||
} else {
|
||||
sudoers_io.log_ttyout = NULL;
|
||||
}
|
||||
@@ -512,7 +512,7 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
|
||||
io_fds[IOFD_STDOUT].v = open_io_fd(pathbuf, len, "/stdout",
|
||||
iolog_compress);
|
||||
if (io_fds[IOFD_STDOUT].v == NULL)
|
||||
log_error(USE_ERRNO, _("Can't create %s"), pathbuf);
|
||||
log_error(USE_ERRNO, _("unable to create %s"), pathbuf);
|
||||
} else {
|
||||
sudoers_io.log_stdout = NULL;
|
||||
}
|
||||
@@ -520,7 +520,7 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
|
||||
io_fds[IOFD_STDERR].v = open_io_fd(pathbuf, len, "/stderr",
|
||||
iolog_compress);
|
||||
if (io_fds[IOFD_STDERR].v == NULL)
|
||||
log_error(USE_ERRNO, _("Can't create %s"), pathbuf);
|
||||
log_error(USE_ERRNO, _("unable to create %s"), pathbuf);
|
||||
} else {
|
||||
sudoers_io.log_stderr = NULL;
|
||||
}
|
||||
|
@@ -190,10 +190,10 @@ do_logfile(char *msg)
|
||||
fp = fopen(def_logfile, "a");
|
||||
(void) umask(oldmask);
|
||||
if (fp == NULL) {
|
||||
send_mail(_("Can't open log file: %s: %s"),
|
||||
send_mail(_("unable to open log file: %s: %s"),
|
||||
def_logfile, strerror(errno));
|
||||
} else if (!lock_file(fileno(fp), SUDO_LOCK)) {
|
||||
send_mail(_("Can't lock log file: %s: %s"),
|
||||
send_mail(_("unable to lock log file: %s: %s"),
|
||||
def_logfile, strerror(errno));
|
||||
} else {
|
||||
time_t now;
|
||||
|
@@ -122,7 +122,7 @@ static int fork_cmnd(struct command_details *details, int sv[2])
|
||||
child = fork();
|
||||
switch (child) {
|
||||
case -1:
|
||||
error(1, "fork");
|
||||
error(1, _("unable to fork"));
|
||||
break;
|
||||
case 0:
|
||||
/* child */
|
||||
|
@@ -559,14 +559,14 @@ fork_pty(struct command_details *details, int sv[], int *maxfd)
|
||||
n = term_raw(io_fds[SFD_USERTTY], 0);
|
||||
} while (!n && errno == EINTR);
|
||||
if (!n)
|
||||
error(1, _("Can't set terminal to raw mode"));
|
||||
error(1, _("unable to set terminal to raw mode"));
|
||||
}
|
||||
}
|
||||
|
||||
child = fork();
|
||||
switch (child) {
|
||||
case -1:
|
||||
error(1, "fork");
|
||||
error(1, _("unable to fork"));
|
||||
break;
|
||||
case 0:
|
||||
/* child */
|
||||
@@ -873,7 +873,7 @@ exec_monitor(struct command_details *details, int backchannel)
|
||||
error(1, _("unable to create pipe"));
|
||||
child = fork();
|
||||
if (child == -1) {
|
||||
warning("fork");
|
||||
warning(_("unable to fork"));
|
||||
goto bad;
|
||||
}
|
||||
if (child == 0) {
|
||||
|
@@ -183,8 +183,8 @@ sudo_load_plugins(const char *conf_file,
|
||||
}
|
||||
plugin = dlsym(handle, info->symbol_name);
|
||||
if (!plugin) {
|
||||
warningx(_("unable to find symbol %s in %s"), info->symbol_name,
|
||||
path);
|
||||
warningx(_("%s: unable to find symbol %s"), path,
|
||||
info->symbol_name);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,8 @@ sudo_load_plugins(const char *conf_file,
|
||||
}
|
||||
if (plugin->type == SUDO_POLICY_PLUGIN) {
|
||||
if (policy_plugin->handle) {
|
||||
warningx(_("only a single policy plugin may be loaded"));
|
||||
warningx(_("%s: only a single policy plugin may be loaded"),
|
||||
conf_file);
|
||||
goto done;
|
||||
}
|
||||
policy_plugin->handle = handle;
|
||||
|
@@ -212,7 +212,7 @@ main(int argc, char *argv[], char *envp[])
|
||||
if (ISSET(sudo_mode, MODE_VERSION)) {
|
||||
printf(_("Sudo version %s\n"), PACKAGE_VERSION);
|
||||
if (user_details.uid == ROOT_UID)
|
||||
(void) printf(_("Configure args: %s\n"), CONFIGURE_ARGS);
|
||||
(void) printf(_("Configure options: %s\n"), CONFIGURE_ARGS);
|
||||
}
|
||||
|
||||
/* Read sudo.conf and load plugins. */
|
||||
@@ -916,7 +916,7 @@ exec_setup(struct command_details *details, const char *ptyname, int ptyfd)
|
||||
*/
|
||||
#ifdef HAVE_SETEUID
|
||||
if (ISSET(details->flags, CD_SET_EGID) && setegid(details->egid)) {
|
||||
warning(_("unable to set egid to runas gid %u"), details->egid);
|
||||
warning(_("unable to set effective gid to runas gid %u"), details->egid);
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
@@ -1129,7 +1129,7 @@ static int
|
||||
policy_validate(struct plugin_container *plugin)
|
||||
{
|
||||
if (plugin->u.policy->validate == NULL) {
|
||||
warningx(_("policy plugin %s does not support the -v flag"),
|
||||
warningx(_("policy plugin %s does not support the -v option"),
|
||||
plugin->name);
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1140,7 +1140,7 @@ static void
|
||||
policy_invalidate(struct plugin_container *plugin, int remove)
|
||||
{
|
||||
if (plugin->u.policy->invalidate == NULL) {
|
||||
errorx(1, _("policy plugin %s does not support the -k/-K flags"),
|
||||
errorx(1, _("policy plugin %s does not support the -k/-K options"),
|
||||
plugin->name);
|
||||
}
|
||||
plugin->u.policy->invalidate(remove);
|
||||
|
@@ -105,7 +105,7 @@ sudo_edit(struct command_details *command_details)
|
||||
* We will change the euid as needed below.
|
||||
*/
|
||||
if (setuid(ROOT_UID) != 0) {
|
||||
warning(_("unable to change to uid to root (%u)"), ROOT_UID);
|
||||
warning(_("unable to change uid to root (%u)"), ROOT_UID);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user