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/comm.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/comm.c')
-rw-r--r-- | src/comm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/comm.c b/src/comm.c index ea7a28415..a6fbde196 100644 --- a/src/comm.c +++ b/src/comm.c @@ -274,13 +274,13 @@ compare_files (char **infiles) alt[i][2] = 0; streams[i] = (STREQ (infiles[i], "-") ? stdin : fopen (infiles[i], "r")); if (!streams[i]) - error (EXIT_FAILURE, errno, "%s", infiles[i]); + error (EXIT_FAILURE, errno, "%s", quote (infiles[i])); fadvise (streams[i], FADVISE_SEQUENTIAL); thisline[i] = readlinebuffer (all_line[i][alt[i][0]], streams[i]); if (ferror (streams[i])) - error (EXIT_FAILURE, errno, "%s", infiles[i]); + error (EXIT_FAILURE, errno, "%s", quote (infiles[i])); } while (thisline[0] || thisline[1]) @@ -350,7 +350,7 @@ compare_files (char **infiles) all_line[i][alt[i][1]], i + 1); if (ferror (streams[i])) - error (EXIT_FAILURE, errno, "%s", infiles[i]); + error (EXIT_FAILURE, errno, "%s", quote (infiles[i])); fill_up[i] = false; } @@ -358,7 +358,7 @@ compare_files (char **infiles) for (i = 0; i < 2; i++) if (fclose (streams[i]) != 0) - error (EXIT_FAILURE, errno, "%s", infiles[i]); + error (EXIT_FAILURE, errno, "%s", quote (infiles[i])); } int |