diff options
author | Bui Nguyen Quoc Thanh <49302843+thanhbnq@users.noreply.github.com> | 2022-07-07 11:00:34 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 11:00:34 +0700 |
commit | 855e0017a980d2990c16f7dbf3b4983b48fac272 (patch) | |
tree | b7019f1e75d74d1361d6718cb78ad20524ac865c /src/console | |
parent | ba26a823e8f4dbde70b30bce9744f3b8fa340fce (diff) | |
download | DLT-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')
-rw-r--r-- | src/console/dlt-convert.c | 18 | ||||
-rw-r--r-- | src/console/dlt-sortbytimestamp.c | 6 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/console/dlt-convert.c b/src/console/dlt-convert.c index b82c104..30ea09a 100644 --- a/src/console/dlt-convert.c +++ b/src/console/dlt-convert.c @@ -432,31 +432,37 @@ int main(int argc, char *argv[]) } for (num = begin; num <= end; num++) { - dlt_file_message(&file, num, vflag); + if (dlt_file_message(&file, num, vflag) < DLT_RETURN_OK) + continue; if (xflag) { printf("%d ", num); - dlt_message_print_hex(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag); + if (dlt_message_print_hex(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag) < DLT_RETURN_OK) + continue; } else if (aflag) { printf("%d ", num); - dlt_message_header(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag); + if (dlt_message_header(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag) < DLT_RETURN_OK) + continue; printf("%s ", text); - dlt_message_payload(&file.msg, text, DLT_CONVERT_TEXTBUFSIZE, DLT_OUTPUT_ASCII, vflag); + if (dlt_message_payload(&file.msg, text, DLT_CONVERT_TEXTBUFSIZE, DLT_OUTPUT_ASCII, vflag) < DLT_RETURN_OK) + continue; printf("[%s]\n", text); } else if (mflag) { printf("%d ", num); - dlt_message_print_mixed_plain(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag); + if (dlt_message_print_mixed_plain(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag) < DLT_RETURN_OK) + continue; } else if (sflag) { printf("%d ", num); - dlt_message_header(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag); + if (dlt_message_header(&(file.msg), text, DLT_CONVERT_TEXTBUFSIZE, vflag) < DLT_RETURN_OK) + continue; printf("%s \n", text); } 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; |