diff options
author | Pádraig Brady <P@draigBrady.com> | 2015-10-27 13:13:59 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-10-27 17:24:54 +0000 |
commit | 6796698c9945d87236ffcc939137d0919ef04931 (patch) | |
tree | dd843e7808186887c2959451e34fdd7f42783359 /src/install.c | |
parent | 106d4bf159a97b573d6479473fa38216fb8bfada (diff) | |
download | coreutils-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/install.c')
-rw-r--r-- | src/install.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/install.c b/src/install.c index bfde21d63..bbd67bc02 100644 --- a/src/install.c +++ b/src/install.c @@ -532,7 +532,7 @@ strip (char const *name) break; case 0: /* Child. */ execlp (strip_program, strip_program, name, NULL); - error (EXIT_FAILURE, errno, _("cannot run %s"), strip_program); + error (EXIT_FAILURE, errno, _("cannot run %s"), quote (strip_program)); break; default: /* Parent. */ if (waitpid (pid, &status, 0) < 0) @@ -693,7 +693,7 @@ install_file_in_file (const char *from, const char *to, if (! strip (to)) { if (unlink (to) != 0) /* Cleanup. */ - error (EXIT_FAILURE, errno, _("cannot unlink %s"), to); + error (EXIT_FAILURE, errno, _("cannot unlink %s"), quote (to)); return false; } if (x->preserve_timestamps && (strip_files || ! S_ISREG (from_sb.st_mode)) @@ -719,7 +719,7 @@ mkancesdirs_safe_wd (char const *from, char *to, struct cp_options *x) if (mkancesdirs (to, &wd, make_ancestor, x) == -1) { - error (0, errno, _("cannot create directory %s"), to); + error (0, errno, _("cannot create directory %s"), quote (to)); status = EXIT_FAILURE; } @@ -732,7 +732,7 @@ mkancesdirs_safe_wd (char const *from, char *to, struct cp_options *x) return false; if (restore_result < 0 && status == EXIT_SUCCESS) { - error (0, restore_errno, _("cannot create directory %s"), to); + error (0, restore_errno, _("cannot create directory %s"), quote (to)); return false; } } |