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/expr.c | |
| parent | md5sum: quote all printed file names (diff) | |
| download | coreutils-6796698c9945d87236ffcc939137d0919ef04931.tar.gz coreutils-6796698c9945d87236ffcc939137d0919ef04931.zip | |
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/expr.c')
| -rw-r--r-- | src/expr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/expr.c b/src/expr.c index b368e237c..536e68131 100644 --- a/src/expr.c +++ b/src/expr.c @@ -466,7 +466,7 @@ toarith (VALUE *v) if (! looks_like_integer (s)) return false; if (mpz_init_set_str (v->u.i, s, 10) != 0 && !HAVE_GMP) - error (EXPR_FAILURE, ERANGE, "%s", s); + error (EXPR_FAILURE, ERANGE, "%s", (s)); free (s); v->type = integer; return true; @@ -562,7 +562,7 @@ docolon (VALUE *sv, VALUE *pv) RE_SYNTAX_POSIX_BASIC & ~RE_CONTEXT_INVALID_DUP & ~RE_NO_EMPTY_RANGES; errmsg = re_compile_pattern (pv->u.s, strlen (pv->u.s), &re_buffer); if (errmsg) - error (EXPR_INVALID, 0, "%s", errmsg); + error (EXPR_INVALID, 0, "%s", (errmsg)); re_buffer.newline_anchor = 0; matchlen = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs); |
