summaryrefslogtreecommitdiff
path: root/src/kill.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2015-10-27 13:13:59 +0000
committerPádraig Brady <P@draigBrady.com>2015-10-27 17:24:54 +0000
commit6796698c9945d87236ffcc939137d0919ef04931 (patch)
treedd843e7808186887c2959451e34fdd7f42783359 /src/kill.c
parent106d4bf159a97b573d6479473fa38216fb8bfada (diff)
downloadcoreutils-6796698c9945d87236ffcc939137d0919ef04931.tar.xz
all: quote string arguments in error messages
These strings are often file names or other user specified parameters, which can give confusing errors in the presence of unexpected characters for example. * cfg.mk (sc_error_quotes): A new syntax check rule. * src/*.c: Wrap error() string arguments with quote(). * tests/: Adjust accordingly. * NEWS: Mention the improvement.
Diffstat (limited to 'src/kill.c')
-rw-r--r--src/kill.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/kill.c b/src/kill.c
index 83016ed3c..98b270f75 100644
--- a/src/kill.c
+++ b/src/kill.c
@@ -26,6 +26,7 @@
#include "error.h"
#include "sig2str.h"
#include "operand2sig.h"
+#include "quote.h"
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "kill"
@@ -202,12 +203,12 @@ send_signals (int signum, char *const *argv)
if (errno == ERANGE || pid != n || arg == endp || *endp)
{
- error (0, 0, _("%s: invalid process id"), arg);
+ error (0, 0, _("%s: invalid process id"), quote (arg));
status = EXIT_FAILURE;
}
else if (kill (pid, signum) != 0)
{
- error (0, errno, "%s", arg);
+ error (0, errno, "%s", quote (arg));
status = EXIT_FAILURE;
}
}
@@ -265,7 +266,7 @@ main (int argc, char **argv)
case 's':
if (0 <= signum)
{
- error (0, 0, _("%s: multiple signals specified"), optarg);
+ error (0, 0, _("%s: multiple signals specified"), quote (optarg));
usage (EXIT_FAILURE);
}
signum = operand2sig (optarg, signame);