diff options
author | Bartosz Golaszewski <bartekgola@gmail.com> | 2014-03-07 11:46:03 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-03-07 11:46:03 +0100 |
commit | 58adbb5505d0c643c18d956934aa8afa18e612eb (patch) | |
tree | 82a33e21b7a24723dd85c0bdc20798cd910cd5e6 /coreutils | |
parent | 0ed5f7aacd5e412d80524a1fc7f90b55f470827b (diff) | |
download | busybox-w32-58adbb5505d0c643c18d956934aa8afa18e612eb.tar.gz busybox-w32-58adbb5505d0c643c18d956934aa8afa18e612eb.tar.bz2 busybox-w32-58adbb5505d0c643c18d956934aa8afa18e612eb.zip |
shuf: fix a segfault on 'shuf -e'
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/shuf.c | 3 |
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) | |||
126 | fclose_if_not_stdin(fp); | 126 | fclose_if_not_stdin(fp); |
127 | } | 127 | } |
128 | 128 | ||
129 | shuffle_lines(lines, numlines); | 129 | if (numlines != 0) |
130 | shuffle_lines(lines, numlines); | ||
130 | 131 | ||
131 | if (opts & OPT_o) | 132 | if (opts & OPT_o) |
132 | xmove_fd(xopen(opt_o_str, O_WRONLY|O_CREAT|O_TRUNC), STDOUT_FILENO); | 133 | xmove_fd(xopen(opt_o_str, O_WRONLY|O_CREAT|O_TRUNC), STDOUT_FILENO); |