[PATCH 4/4] textual: harmonize the wording of the error message for an invalid PID

Benno Schulenberg <[email protected]>
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
Having four different forms for the same basic message is unneeded.

Signed-off-by: Benno Schulenberg <[email protected]>
---
 misc-utils/kill.c      | 4 ++--
 misc-utils/lsclocks.c  | 2 +-
 misc-utils/lslocks.c   | 2 +-
 misc-utils/waitpid.c   | 2 +-
 schedutils/coresched.c | 5 ++---
 schedutils/taskset.c   | 3 +--
 sys-utils/setpriv.c    | 2 +-
 7 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/misc-utils/kill.c b/misc-utils/kill.c
index fefe0d891..81dd5f191 100644
--- a/misc-utils/kill.c
+++ b/misc-utils/kill.c
@@ -396,7 +396,7 @@ static char **parse_arguments(int argc, char **argv, struct kill_control *ctl)
 			if (2 < argc)
 				errx(EXIT_FAILURE, _("too many arguments"));
 			arg = argv[1];
-			pid = strtopid_or_err(arg, _("invalid pid argument"));
+			pid = strtopid_or_err(arg, _("invalid PID argument"));
 			print_process_signal_state(pid);
 			exit(EXIT_SUCCESS);
 		}
@@ -404,7 +404,7 @@ static char **parse_arguments(int argc, char **argv, struct kill_control *ctl)
 			pid_t pid;
 			char *p = strchr(arg, '=') + 1;
 
-			pid = strtopid_or_err(p, _("invalid pid argument"));
+			pid = strtopid_or_err(p, _("invalid PID argument"));
 			print_process_signal_state((pid_t)pid);
 			exit(EXIT_SUCCESS);
 		}
diff --git a/misc-utils/lsclocks.c b/misc-utils/lsclocks.c
index 376bc6e51..42a91fb94 100644
--- a/misc-utils/lsclocks.c
+++ b/misc-utils/lsclocks.c
@@ -593,7 +593,7 @@ int main(int argc, char **argv)
 			break;
 		case 'c':
 			cpu_clock = xmalloc(sizeof(*cpu_clock));
-			cpu_clock->pid = strtopid_or_err(optarg, _("failed to parse pid"));
+			cpu_clock->pid = strtopid_or_err(optarg, _("invalid PID argument"));
 			snprintf(cpu_clock->name, sizeof(cpu_clock->name),
 				 "%jd", (intmax_t) cpu_clock->pid);
 			list_add(&cpu_clock->head, &cpu_clocks);
diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c
index e58890207..4ed3a3716 100644
--- a/misc-utils/lslocks.c
+++ b/misc-utils/lslocks.c
@@ -383,7 +383,7 @@ static struct lock *get_lock(char *buf, struct override_info *oinfo, void *fallb
 				l->cmdname = xstrdup(oinfo->cmdname);
 			} else {
 				/* strtopid_or_err() is not suitable here; tok can be -1.*/
-				l->pid = strtos32_or_err(tok, _("failed to parse pid"));
+				l->pid = strtos32_or_err(tok, _("invalid PID argument"));
 				if (l->pid > 0) {
 					l->cmdname = pid_get_cmdname(l->pid);
 					if (!l->cmdname)
diff --git a/misc-utils/waitpid.c b/misc-utils/waitpid.c
index 4d77e1df4..379246b26 100644
--- a/misc-utils/waitpid.c
+++ b/misc-utils/waitpid.c
@@ -51,7 +51,7 @@ static pid_t *parse_pids(size_t n_strings, char * const *strings)
 	pid_t *pids = xcalloc(n_strings, sizeof(*pids));
 
 	for (size_t i = 0; i < n_strings; i++)
-		pids[i] = strtopid_or_err(strings[i], _("failed to parse pid"));
+		pids[i] = strtopid_or_err(strings[i], _("invalid PID argument"));
 
 	return pids;
 }
diff --git a/schedutils/coresched.c b/schedutils/coresched.c
index 7634d988c..419745897 100644
--- a/schedutils/coresched.c
+++ b/schedutils/coresched.c
@@ -232,12 +232,11 @@ static void parse_and_verify_arguments(int argc, char **argv, struct args *args)
 		switch (c) {
 		case 's':
 			args->src = strtopid_or_err(
-				optarg,
-				_("Failed to parse PID for -s/--source"));
+				optarg, _("invalid PID for -s/--source"));
 			break;
 		case 'd':
 			args->dest = strtopid_or_err(
-				optarg, _("Failed to parse PID for -d/--dest"));
+				optarg, _("invalid PID for -d/--dest"));
 			break;
 		case 't':
 			args->type = parse_core_sched_type(optarg);
diff --git a/schedutils/taskset.c b/schedutils/taskset.c
index 46fef5051..dedcdf602 100644
--- a/schedutils/taskset.c
+++ b/schedutils/taskset.c
@@ -187,8 +187,7 @@ int main(int argc, char **argv)
 			all_tasks = 1;
 			break;
 		case 'p':
-			pid = strtopid_or_err(argv[argc - 1],
-					      _("invalid PID argument"));
+			pid = strtopid_or_err(argv[argc - 1], _("invalid PID argument"));
 			break;
 		case 'c':
 			ts.use_list = 1;
diff --git a/sys-utils/setpriv.c b/sys-utils/setpriv.c
index 10274f5f6..d714650e8 100644
--- a/sys-utils/setpriv.c
+++ b/sys-utils/setpriv.c
@@ -473,7 +473,7 @@ static void parse_ptracer(struct privctx *opts, const char *str)
 	} else if (!strcmp(str, "none")) {
 		opts->ptracer = 0;
 	} else {
-		opts->ptracer = strtopid_or_err(str, _("failed to parse ptracer pid"));
+		opts->ptracer = strtopid_or_err(str, _("invalid PID argument"));
 	}
 }
 
-- 
2.48.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.