summaryrefslogtreecommitdiff
path: root/src/shared/dlt_offline_trace.c
diff options
context:
space:
mode:
authorAlexander Mohr <alexander.m.mohr@daimler.com>2020-12-16 17:31:50 +0100
committerSaya Sugiura <ssugiura@jp.adit-jv.com>2021-01-06 09:12:00 +0900
commitcbd51314c3245174b42070a66089b27472486b00 (patch)
treee5a57eb24e17b081088da5115e0afaa03d96601e /src/shared/dlt_offline_trace.c
parente7858cfa226f760b6f7ba9a43501ac071b2fd8a8 (diff)
downloadDLT-daemon-cbd51314c3245174b42070a66089b27472486b00.tar.gz
bug-fix: fix invalid file descriptor check
Some functions validated file descriptor to be greater 0. If a process is started without stdin, stdout and stderr the first file descriptor allocated by the process will be 0. This also will be the case if the above mentioned file descriptors will be closed on purpose. As 0 is a valid fd, some methods had to be changed to reflect this. Signed-off-by: Alexander Mohr <alexander.m.mohr@daimler.com>
Diffstat (limited to 'src/shared/dlt_offline_trace.c')
-rw-r--r--src/shared/dlt_offline_trace.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/shared/dlt_offline_trace.c b/src/shared/dlt_offline_trace.c
index 1f6a5d5..2d70a77 100644
--- a/src/shared/dlt_offline_trace.c
+++ b/src/shared/dlt_offline_trace.c
@@ -396,7 +396,7 @@ DltReturnValue dlt_offline_trace_write(DltOfflineTrace *trace,
int size3)
{
- if (trace->ohandle <= 0)
+ if (trace->ohandle < 0)
return DLT_RETURN_ERROR;
/* check file size here */
@@ -440,7 +440,7 @@ DltReturnValue dlt_offline_trace_write(DltOfflineTrace *trace,
DltReturnValue dlt_offline_trace_free(DltOfflineTrace *trace)
{
- if (trace->ohandle <= 0)
+ if (trace->ohandle < 0)
return DLT_RETURN_ERROR;
/* close last used log file */