From 2c729734692b2c6e12da83c5ab335892e1e82027 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Tue, 7 Jul 2015 00:17:37 +1200 Subject: Last, half-filled buffer is now dumped to output too (whoops) --- cue-bin-split.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cue-bin-split.c b/cue-bin-split.c index 644ea7d..4b47701 100644 --- a/cue-bin-split.c +++ b/cue-bin-split.c @@ -148,13 +148,16 @@ int main(int argc, char **argv) MIN(sizeof(buffer)/sample_size, (finish_sample - i)), fin); - if (feof(fin)) - break; - - if (ferror(fin)) + if (items == 0) { - perror("fread"); - break; + if (feof(fin)) + break; + + if (ferror(fin)) + { + perror("fread"); + break; + } } if (fwrite(buffer, sample_size, items, fout) != items) -- cgit v1.1