aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/shuf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/coreutils/shuf.c b/coreutils/shuf.c
index f213d6759..648a4abbb 100644
--- a/coreutils/shuf.c
+++ b/coreutils/shuf.c
@@ -126,7 +126,8 @@ int shuf_main(int argc, char **argv)
fclose_if_not_stdin(fp);
}
- shuffle_lines(lines, numlines);
+ if (numlines != 0)
+ shuffle_lines(lines, numlines);
if (opts & OPT_o)
xmove_fd(xopen(opt_o_str, O_WRONLY|O_CREAT|O_TRUNC), STDOUT_FILENO);