summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
authorTom Rondeau2010-11-21 21:17:42 -0500
committerTom Rondeau2010-11-21 21:17:42 -0500
commit9217bbcafe547fd5815265758370b07c375d72c9 (patch)
treecac219a66309aa931130a376d7c989760e347234 /gnuradio-core
parent1b7b68ec2211c50de98bef7414e4ac807edf460a (diff)
downloadgnuradio-9217bbcafe547fd5815265758370b07c375d72c9.tar.gz
gnuradio-9217bbcafe547fd5815265758370b07c375d72c9.tar.bz2
gnuradio-9217bbcafe547fd5815265758370b07c375d72c9.zip
Fixed file tagger error handling so it doesn't prematurely exit under certain, but correct, conditions.
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.cc25
1 files changed, 17 insertions, 8 deletions
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
index 500a359b3..371d6268c 100644
--- a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
@@ -172,28 +172,37 @@ gr_tagged_file_sink::work (int noutput_items,
while(vitr != all_tags.end()) {
if((pmt::pmt_eqv(gr_tags::get_key(*vitr), bkey)) &&
pmt::pmt_is_false(gr_tags::get_value(*vitr))) {
- uint64_t N = gr_tags::get_nitems(*vitr) - start_N;
- idx_stop = (int)N;
+ uint64_t N = gr_tags::get_nitems(*vitr);
+ idx_stop = (int)N - start_N;
+
+ std::cout << "Found end of burst: "
+ << idx_stop << ", " << N << std::endl;
int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize, idx_stop-idx, d_handle);
- if (count == 0)
- break;
+ if (count == 0) {
+ if(ferror(d_handle)) {
+ perror("gr_tagged_file_sink: error writing file");
+ }
+ }
idx = idx_stop;
d_state = NOT_IN_BURST;
vitr++;
fclose(d_handle);
break;
- } else {
+ }
+ else {
vitr++;
}
}
if(d_state == IN_BURST) {
int count = fwrite (&inbuf[idx], d_itemsize, noutput_items-idx, d_handle);
- if (count == 0)
- break;
+ if (count == 0) {
+ if(ferror(d_handle)) {
+ perror("gr_tagged_file_sink: error writing file");
+ }
+ }
idx = noutput_items;
}
-
}
}