]> granicus.if.org Git - sudo/commitdiff
Minor warning/error message cleanup
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 18 May 2011 17:04:24 +0000 (13:04 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 18 May 2011 17:04:24 +0000 (13:04 -0400)
plugins/sudoers/check.c
plugins/sudoers/iolog.c
plugins/sudoers/logging.c
src/exec.c
src/exec_pty.c
src/load_plugins.c
src/sudo.c
src/sudo_edit.c

index 0faa13caea85d3b4ce6af10601998489c58b4da5..a807a504368f2f52c82d20bafb7d1c3f34e1ba59 100644 (file)
@@ -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)
index 36f6176148b0417a3ff2f8cf91620c1c8ce4ad09..f60f64ef32c727d97c0167fd585d78ec4d2fbd27 100644 (file)
@@ -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;
     }
index 606ead75ee20381ebff6cf19a579518a1ad202d3..9d8411f631899c1fdfacae3f2147c102b3601423 100644 (file)
@@ -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;
index bf530b83de3b1a18e5bc9149d40c9a57ca80caa7..bb4ea68a50ab11c2d54983b018d4d4187ab3223b 100644 (file)
@@ -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 */
index 02227070bb9b51741b4e77badfbdc558dfd6b4a7..44d251f4cd5d4bf1bbc6972a0d8ebb73b2e6c047 100644 (file)
@@ -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) {
index f7ecfba8b7790972dc02e21d35b9748b6554ed9f..e756e57edfe7b15d70d4480c63a9a8f6c60b9a30 100644 (file)
@@ -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;
index 57f10c4f7eda44bf3c807a6fdff4fc41b0141c9f..768a8a518d001f23ba17e692d4d56c2fac04be92 100644 (file)
@@ -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);
index fd8813c0b8c723fb15b5bf7a0e67be95277a136a..99393cf7ae1766bfd1d7ba160594dc41198ccce4 100644 (file)
@@ -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;
     }