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/tsort.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/tsort.c')
-rw-r--r-- | src/tsort.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tsort.c b/src/tsort.c index 0533451da..dc9bed5e9 100644 --- a/src/tsort.c +++ b/src/tsort.c @@ -351,7 +351,7 @@ detect_loop (struct item *k) { struct item *tmp = loop->qlink; - error (0, 0, "%s", loop->str); + error (0, 0, "%s", (loop->str)); /* Until we encounter K again. */ if (loop == k) @@ -445,7 +445,7 @@ tsort (const char *file) root = new_item (NULL); if (!is_stdin && ! freopen (file, "r", stdin)) - error (EXIT_FAILURE, errno, "%s", file); + error (EXIT_FAILURE, errno, "%s", quote (file)); fadvise (stdin, FADVISE_SEQUENTIAL); @@ -473,7 +473,7 @@ tsort (const char *file) if (k != NULL) error (EXIT_FAILURE, 0, _("%s: input contains an odd number of tokens"), - file); + quote (file)); /* T1. Initialize (N <- n). */ walk_tree (root, count_items); @@ -518,7 +518,7 @@ tsort (const char *file) if (n_strings > 0) { /* The input contains a loop. */ - error (0, 0, _("%s: input contains a loop:"), file); + error (0, 0, _("%s: input contains a loop:"), quote (file)); ok = false; /* Print the loop and remove a relation to break it. */ |