aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/odr-padenc.cpp4
-rw-r--r--src/pad_common.cpp12
2 files changed, 14 insertions, 2 deletions
diff --git a/src/odr-padenc.cpp b/src/odr-padenc.cpp
index c42ddf0..2fd3a47 100644
--- a/src/odr-padenc.cpp
+++ b/src/odr-padenc.cpp
@@ -168,6 +168,10 @@ int main(int argc, char *argv[]) {
perror("ODR-PadEnc Error: could not set SIGTERM handler");
return 1;
}
+ if(signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
+ perror("ODR-PadEnc Error: could not set SIGPIPE to be ignored");
+ return 1;
+ }
size_t padlen = 58;
bool erase_after_tx = false;
diff --git a/src/pad_common.cpp b/src/pad_common.cpp
index 4d2d9af..5ba4c7f 100644
--- a/src/pad_common.cpp
+++ b/src/pad_common.cpp
@@ -132,6 +132,9 @@ pad_t* PADPacketizer::GetPAD() {
}
void PADPacketizer::WriteAllPADs(int output_fd, int limit) {
+ size_t error_count = 0;
+ size_t error_bytes = 0;
+
// output a limited amount of PADs (-1 = no limit)
for (int i = 0; i != limit; i++) {
pad_t* pad = GetPAD();
@@ -142,11 +145,16 @@ void PADPacketizer::WriteAllPADs(int output_fd, int limit) {
break;
}
- if (write(output_fd, &(*pad)[0], pad->size()) != (signed) pad->size())
- fprintf(stderr, "ODR-PadEnc Error: Could not write PAD\n");
+ if (write(output_fd, &(*pad)[0], pad->size()) != (signed) pad->size()) {
+ error_count++;
+ error_bytes += pad->size();
+ }
delete pad;
}
+
+ if (error_count)
+ fprintf(stderr, "ODR-PadEnc Error: Could not write %zu PAD(s) with %zu Bytes\n", error_count, error_bytes);
}