summaryrefslogtreecommitdiff
path: root/src/console/dlt-sortbytimestamp.c
diff options
context:
space:
mode:
authorBui Nguyen Quoc Thanh <49302843+thanhbnq@users.noreply.github.com>2022-07-07 11:00:34 +0700
committerGitHub <noreply@github.com>2022-07-07 11:00:34 +0700
commit855e0017a980d2990c16f7dbf3b4983b48fac272 (patch)
treeb7019f1e75d74d1361d6718cb78ad20524ac865c /src/console/dlt-sortbytimestamp.c
parentba26a823e8f4dbde70b30bce9744f3b8fa340fce (diff)
downloadDLT-daemon-855e0017a980d2990c16f7dbf3b4983b48fac272.tar.gz
Fix handle returned value (#384)
* common: Handle returned value - The returned value of supporting APIs should be checked correctly. - In case of extended header, the buffer of header must be checked before proceeding further. Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com> * console: Handle returned value In case of parsing dlt file, the failed messages should be skipped by evaluating returned value Signed-off-by: Bui Nguyen Quoc Thanh <thanh.buinguyenquoc@vn.bosch.com>
Diffstat (limited to 'src/console/dlt-sortbytimestamp.c')
-rw-r--r--src/console/dlt-sortbytimestamp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/console/dlt-sortbytimestamp.c b/src/console/dlt-sortbytimestamp.c
index 3e418e1..82fd5d0 100644
--- a/src/console/dlt-sortbytimestamp.c
+++ b/src/console/dlt-sortbytimestamp.c
@@ -160,7 +160,8 @@ void write_messages(int ohandle, DltFile *file,
if ((0 == i % 1001) || (i == message_count - 1))
verbose(2, "Writing message %d\r", i);
- dlt_file_message(file, timestamps[i].num, 0);
+ if (dlt_file_message(file, timestamps[i].num, 0) < DLT_RETURN_OK)
+ continue;
iov[0].iov_base = file->msg.headerbuffer;
iov[0].iov_len = file->msg.headersize;
iov[1].iov_base = file->msg.databuffer;
@@ -402,7 +403,8 @@ int main(int argc, char *argv[]) {
verbose(1, "Filling %d entries\n", message_count);
for (num = begin; num <= end; num++) {
- dlt_file_message(&file, num, vflag);
+ if (dlt_file_message(&file, num, vflag) < DLT_RETURN_OK)
+ continue;
timestamp_index[num - begin].num = num;
timestamp_index[num - begin].systmsp = file.msg.storageheader->seconds;
timestamp_index[num - begin].tmsp = file.msg.headerextra.tmsp;