summaryrefslogtreecommitdiff
path: root/src/shuf.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-01-05 19:40:03 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2015-01-05 19:40:21 -0800
commit63bc65fbe7ae850a03e0f343cf922767b4faf3ab (patch)
treea5bcb0ad5c383ad0b9ac94fda6ba903df3c895a0 /src/shuf.c
parent7f235156bcf644c4cccc5670f0468d89c64b822d (diff)
downloadcoreutils-63bc65fbe7ae850a03e0f343cf922767b4faf3ab.tar.xz
shuf: do not mishandle 'shuf -i0-0 1'
Problem reported by Daiki Ueno in: http://bugs.gnu.org/19520 * src/shuf.c (main): Avoid core dump if !input_range. * tests/misc/shuf.sh: Test for this bug.
Diffstat (limited to 'src/shuf.c')
-rw-r--r--src/shuf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shuf.c b/src/shuf.c
index 75211bd4b..9db027c18 100644
--- a/src/shuf.c
+++ b/src/shuf.c
@@ -501,7 +501,7 @@ main (int argc, char **argv)
}
if (input_range ? 0 < n_operands : !echo && 1 < n_operands)
{
- error (0, 0, _("extra operand %s"), quote (operand[1]));
+ error (0, 0, _("extra operand %s"), quote (operand[!input_range]));
usage (EXIT_FAILURE);
}