From: Todd C. Miller <Todd.Miller@courtesan.com>
Date: Wed, 18 May 2011 16:36:26 +0000 (-0400)
Subject: can't -> "unable to" in warning/error messages
X-Git-Tag: SUDO_1_8_2~144^2~1
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6f8cd91928cd76d71819e811a7aa543849a61d0c;p=sudo

can't -> "unable to" in warning/error messages
---

diff --git a/plugins/sudoers/check.c b/plugins/sudoers/check.c
index cc7122f22..0faa13cae 100644
--- a/plugins/sudoers/check.c
+++ b/plugins/sudoers/check.c
@@ -463,12 +463,12 @@ timestamp_status(char *timestampdir, char *timestampfile, char *user, int flags)
 	    status = TS_MISSING;
 	}
     } else if (errno != ENOENT) {
-	log_error(NO_EXIT|USE_ERRNO, _("can't stat %s"), dirparent);
+	log_error(NO_EXIT|USE_ERRNO, _("unable to stat %s"), dirparent);
     } else {
 	/* No dirparent, try to make one. */
 	if (ISSET(flags, TS_MAKE_DIRS)) {
 	    if (mkdir(dirparent, S_IRWXU))
-		log_error(NO_EXIT|USE_ERRNO, _("can't mkdir %s"),
+		log_error(NO_EXIT|USE_ERRNO, _("unable to mkdir %s"),
 		    dirparent);
 	    else
 		status = TS_MISSING;
@@ -507,7 +507,7 @@ timestamp_status(char *timestampdir, char *timestampfile, char *user, int flags)
 	    status = TS_OLD;		/* do date check later */
 	}
     } else if (errno != ENOENT) {
-	log_error(NO_EXIT|USE_ERRNO, _("can't stat %s"), timestampdir);
+	log_error(NO_EXIT|USE_ERRNO, _("unable to stat %s"), timestampdir);
     } else
 	status = TS_MISSING;
 
@@ -518,7 +518,7 @@ timestamp_status(char *timestampdir, char *timestampfile, char *user, int flags)
     if (status == TS_MISSING && timestampfile && ISSET(flags, TS_MAKE_DIRS)) {
 	if (mkdir(timestampdir, S_IRWXU) == -1) {
 	    status = TS_ERROR;
-	    log_error(NO_EXIT|USE_ERRNO, _("can't mkdir %s"), timestampdir);
+	    log_error(NO_EXIT|USE_ERRNO, _("unable to mkdir %s"), timestampdir);
 	}
     }
 
@@ -575,7 +575,7 @@ timestamp_status(char *timestampdir, char *timestampfile, char *user, int flags)
 		}
 	    }
 	} else if (errno != ENOENT) {
-	    log_error(NO_EXIT|USE_ERRNO, _("can't stat %s"), timestampfile);
+	    log_error(NO_EXIT|USE_ERRNO, _("unable to stat %s"), timestampfile);
 	    status = TS_ERROR;
 	}
     }
@@ -644,14 +644,15 @@ remove_timestamp(int remove)
 	    else
 		status = rmdir(timestampdir);
 	    if (status == -1 && errno != ENOENT) {
-		log_error(NO_EXIT, _("can't remove %s (%s), will reset to Epoch"),
+		log_error(NO_EXIT,
+		    _("unable to remove %s (%s), will reset to the epoch"),
 		    path, strerror(errno));
 		remove = FALSE;
 	    }
 	} else {
 	    timevalclear(&tv);
 	    if (touch(-1, path, &tv) == -1 && errno != ENOENT)
-		error(1, _("can't reset %s to Epoch"), path);
+		error(1, _("unable to reset %s to the epoch"), path);
 	}
     }
 
diff --git a/plugins/sudoers/mon_systrace.c b/plugins/sudoers/mon_systrace.c
index 4ff4332d6..a463a7146 100644
--- a/plugins/sudoers/mon_systrace.c
+++ b/plugins/sudoers/mon_systrace.c
@@ -120,12 +120,12 @@ systrace_attach(pid)
 
     switch (fork()) {
     case -1:
-	error(1, "can't fork");
+	error(1, "unable to fork");
     case 0:
 	/* tracer, fork again to completely disassociate */
 	switch (fork()) {
 	    case -1:
-		warning("can't fork");
+		warning("unable to fork");
 		kill(pid, SIGKILL);
 		_exit(1);
 	    case 0:
@@ -898,13 +898,13 @@ check_execv(fd, pid, seqnr, askp, policyp, errorp)
      */
     if (sudo_goodpath(user_cmnd, user_stat) == NULL) {
 	if (rval != -1 && ioctl(fd, STRIOCRESCWD, 0) != 0)
-	    warning("can't restore cwd");
+	    warning("unable to restore cwd");
 	*policyp = SYSTR_POLICY_NEVER;
 	*errorp = EACCES;
 	return 0;
     }
     if (rval != -1 && ioctl(fd, STRIOCRESCWD, 0) != 0)
-	warning("can't restore cwd");
+	warning("unable to restore cwd");
 
     /* Check sudoers and log the result. */
     init_defaults();
diff --git a/plugins/sudoers/set_perms.c b/plugins/sudoers/set_perms.c
index 37d88b197..f815f7a06 100644
--- a/plugins/sudoers/set_perms.c
+++ b/plugins/sudoers/set_perms.c
@@ -940,7 +940,7 @@ runas_setgroups()
 	aix_setauthdb(pw->pw_name);
 # endif
 	if (initgroups(pw->pw_name, pw->pw_gid) < 0)
-	    log_error(USE_ERRNO|MSG_ONLY, _("can't set runas group vector"));
+	    log_error(USE_ERRNO|MSG_ONLY, _("unable to set runas group vector"));
 # ifdef HAVE_GETGROUPS
 	if (runas_groups) {
 	    efree(runas_groups);
@@ -949,14 +949,14 @@ runas_setgroups()
 	if ((runas_ngroups = getgroups(0, NULL)) > 0) {
 	    runas_groups = emalloc2(runas_ngroups, sizeof(GETGROUPS_T));
 	    if (getgroups(runas_ngroups, runas_groups) < 0)
-		log_error(USE_ERRNO|MSG_ONLY, _("can't get runas group vector"));
+		log_error(USE_ERRNO|MSG_ONLY, _("unable to get runas group vector"));
 	}
 #  ifdef HAVE_SETAUTHDB
 	aix_restoreauthdb();
 #  endif
     } else {
 	if (setgroups(runas_ngroups, runas_groups) < 0)
-	    log_error(USE_ERRNO|MSG_ONLY, _("can't set runas group vector"));
+	    log_error(USE_ERRNO|MSG_ONLY, _("unable to set runas group vector"));
 # endif /* HAVE_GETGROUPS */
     }
 }
diff --git a/plugins/sudoers/sudo_nss.c b/plugins/sudoers/sudo_nss.c
index f246d06da..64e8698ae 100644
--- a/plugins/sudoers/sudo_nss.c
+++ b/plugins/sudoers/sudo_nss.c
@@ -214,13 +214,13 @@ reset_groups(struct passwd *pw)
 	aix_setauthdb(pw->pw_name);
 # endif
 	if (initgroups(pw->pw_name, pw->pw_gid) == -1)
-	    log_error(USE_ERRNO|MSG_ONLY, _("can't reset group vector"));
+	    log_error(USE_ERRNO|MSG_ONLY, _("unable to reset group vector"));
 	efree(user_groups);
 	user_groups = NULL;
 	if ((user_ngroups = getgroups(0, NULL)) > 0) {
 	    user_groups = emalloc2(user_ngroups, sizeof(GETGROUPS_T));
 	    if (getgroups(user_ngroups, user_groups) < 0)
-		log_error(USE_ERRNO|MSG_ONLY, _("can't get group vector"));
+		log_error(USE_ERRNO|MSG_ONLY, _("unable to get group vector"));
 	}
 # ifdef HAVE_SETAUTHDB
 	aix_restoreauthdb();
diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c
index b01dec56e..efd4078a2 100644
--- a/plugins/sudoers/sudoers.c
+++ b/plugins/sudoers/sudoers.c
@@ -924,7 +924,7 @@ open_sudoers(const char *sudoers, int doedit, int *keepopen)
     set_perms(PERM_SUDOERS);
 
     if (rootstat != 0 && stat_sudoers(sudoers, &statbuf) != 0)
-	log_error(USE_ERRNO|NO_EXIT, _("can't stat %s"), sudoers);
+	log_error(USE_ERRNO|NO_EXIT, _("unable to stat %s"), sudoers);
     else if (!S_ISREG(statbuf.st_mode))
 	log_error(NO_EXIT, _("%s is not a regular file"), sudoers);
     else if ((statbuf.st_mode & 07577) != sudoers_mode)
@@ -938,14 +938,14 @@ open_sudoers(const char *sudoers, int doedit, int *keepopen)
 	log_error(NO_EXIT, _("%s is owned by gid %u, should be %u"), sudoers,
 	    (unsigned int) statbuf.st_gid, (unsigned int) sudoers_gid);
     else if ((fp = fopen(sudoers, "r")) == NULL)
-	log_error(USE_ERRNO|NO_EXIT, _("can't open %s"), sudoers);
+	log_error(USE_ERRNO|NO_EXIT, _("unable to open %s"), sudoers);
     else {
 	/*
 	 * Make sure we can actually read sudoers so we can present the
 	 * user with a reasonable error message (unlike the lexer).
 	 */
 	if (statbuf.st_size != 0 && fgetc(fp) == EOF) {
-	    log_error(USE_ERRNO|NO_EXIT, _("can't read %s"), sudoers);
+	    log_error(USE_ERRNO|NO_EXIT, _("unable to read %s"), sudoers);
 	    fclose(fp);
 	    fp = NULL;
 	}
diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c
index 144d9e4dd..91f977214 100644
--- a/plugins/sudoers/visudo.c
+++ b/plugins/sudoers/visudo.c
@@ -286,7 +286,7 @@ edit_sudoers(struct sudoersfile *sp, char *editor, char *args, int lineno)
 #else
     if (stat(sp->path, &sb) == -1)
 #endif
-	error(1, _("can't stat %s"), sp->path);
+	error(1, _("unable to stat %s"), sp->path);
     orig_size = sb.st_size;
     mtim_get(&sb, &orig_mtim);
 
@@ -420,7 +420,7 @@ reparse_sudoers(char *editor, char *args, int strict, int quiet)
 	last = tq_last(&sudoerslist);
 	fp = fopen(sp->tpath, "r+");
 	if (fp == NULL)
-	    errorx(1, _("can't re-open temporary file (%s), %s unchanged."),
+	    errorx(1, _("unable to re-open temporary file (%s), %s unchanged."),
 		sp->tpath, sp->path);
 
 	/* Clean slate for each parse */
@@ -464,8 +464,10 @@ reparse_sudoers(char *editor, char *args, int strict, int quiet)
 		    break;
 		}
 	    }
-	    if (sp == NULL)
-		errorx(1, _("internal error, can't find %s in list!"), sudoers);
+	    if (sp == NULL) {
+		errorx(1, _("internal error, unable to find %s in list!"),
+		    sudoers);
+	    }
 	}
 
 	/* If any new #include directives were added, edit them too. */
@@ -500,7 +502,7 @@ install_sudoers(struct sudoersfile *sp, int oldperms)
 #else
 	if (stat(sp->path, &sb) == -1)
 #endif
-	    error(1, _("can't stat %s"), sp->path);
+	    error(1, _("unable to stat %s"), sp->path);
 	if (chown(sp->tpath, sb.st_uid, sb.st_gid) != 0) {
 	    warning(_("unable to set (uid, gid) of %s to (%d, %d)"),
 		sp->tpath, sb.st_uid, sb.st_gid);
diff --git a/src/exec_pty.c b/src/exec_pty.c
index a5da51ffd..801385e44 100644
--- a/src/exec_pty.c
+++ b/src/exec_pty.c
@@ -133,7 +133,7 @@ pty_setup(uid_t uid, const char *tty, const char *utmp_user)
     if (io_fds[SFD_USERTTY] != -1) {
 	if (!get_pty(&io_fds[SFD_MASTER], &io_fds[SFD_SLAVE],
 	    slavename, sizeof(slavename), uid))
-	    error(1, _("can't allocate pty"));
+	    error(1, _("unable to allocate pty"));
 	/* Add entry to utmp/utmpx? */
 	if (utmp_user != NULL)
 	    utmp_login(tty, slavename, io_fds[SFD_SLAVE], utmp_user);
diff --git a/src/sudo.c b/src/sudo.c
index 4b42652cf..57f10c4f7 100644
--- a/src/sudo.c
+++ b/src/sudo.c
@@ -356,7 +356,7 @@ get_user_groups(struct user_details *ud)
 
     ud->groups = emalloc2(ud->ngroups, sizeof(GETGROUPS_T));
     if (getgroups(ud->ngroups, ud->groups) < 0)
-	error(1, _("can't get group vector"));
+	error(1, _("unable to get group vector"));
     glsize = sizeof("groups=") - 1 + (ud->ngroups * (MAX_UID_T_LEN + 1));
     gid_list = emalloc(glsize);
     memcpy(gid_list, "groups=", sizeof("groups=") - 1);
diff --git a/src/utmp.c b/src/utmp.c
index 9db3da827..befbaf6f2 100644
--- a/src/utmp.c
+++ b/src/utmp.c
@@ -260,12 +260,12 @@ utmp_slot(const char *line, int ttyfd)
      * doesn't take an argument.
      */
     if ((sfd = dup(STDIN_FILENO)) == -1)
-	error(1, _("can't save stdin"));
+	error(1, _("unable to save stdin"));
     if (dup2(ttyfd, STDIN_FILENO) == -1)
-	error(1, _("can't dup2 stdin"));
+	error(1, _("unable to dup2 stdin"));
     slot = ttyslot();
     if (dup2(sfd, STDIN_FILENO) == -1)
-	error(1, _("can't restore stdin"));
+	error(1, _("unable to restore stdin"));
     close(sfd);
 
     return slot;