From 3bbfc218fd5053e95c6de274ef5a28ca80bcdee2 Mon Sep 17 00:00:00 2001 From: Simon Brandner Date: Tue, 5 Feb 2013 14:16:10 +0100 Subject: some coverity fixes fixed some merge problems Signed-off-by: Alexander Wenzel --- src/shared/dlt_common.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'src/shared/dlt_common.c') diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c index fbc1934..09a3258 100755 --- a/src/shared/dlt_common.c +++ b/src/shared/dlt_common.c @@ -1740,7 +1740,11 @@ int dlt_file_read(DltFile *file,int verbose) if (dlt_file_read_header_extended(file, verbose)<0) { /* go back to last position in file */ - fseek(file->handle,file->file_position,SEEK_SET); + if ( 0 != fseek(file->handle,file->file_position,SEEK_SET)) + { + sprintf(str,"Seek to last file pos failed!\n"); + dlt_log(LOG_ERR, str); + } return-1; } @@ -1760,9 +1764,15 @@ int dlt_file_read(DltFile *file,int verbose) if (fseek(file->handle,file->msg.datasize,SEEK_CUR)!=0) { /* go back to last position in file */ - fseek(file->handle,file->file_position,SEEK_SET); sprintf(str,"Seek failed to skip payload data of size %d!\n",file->msg.datasize); dlt_log(LOG_ERR, str); + + if (0 != fseek(file->handle,file->file_position,SEEK_SET)) + { + sprintf(str,"Seek back also failed!\n"); + dlt_log(LOG_ERR, str); + } + return -1; } } @@ -1844,7 +1854,11 @@ int dlt_file_read_raw(DltFile *file,int resync, int verbose) if (dlt_file_read_header_raw(file,resync,verbose)<0) { /* go back to last position in file */ - fseek(file->handle,file->file_position,SEEK_SET); + if (0!= fseek(file->handle,file->file_position,SEEK_SET)) + { + sprintf(str,"dlt_file_read_raw, fseek failed 1\n"); + dlt_log(LOG_ERR, str); + } return -1; } @@ -1852,14 +1866,22 @@ int dlt_file_read_raw(DltFile *file,int resync, int verbose) if (dlt_file_read_header_extended(file, verbose)<0) { /* go back to last position in file */ - fseek(file->handle,file->file_position,SEEK_SET); + if (0 != fseek(file->handle,file->file_position,SEEK_SET)) + { + sprintf(str,"dlt_file_read_raw, fseek failed 2\n"); + dlt_log(LOG_ERR, str); + } return-1; } if (dlt_file_read_data(file,verbose)<0) { /* go back to last position in file */ - fseek(file->handle,file->file_position,SEEK_SET); + if (0 != fseek(file->handle,file->file_position,SEEK_SET)) + { + sprintf(str,"dlt_file_read_raw, fseek failed 3\n"); + dlt_log(LOG_ERR, str); + } return-1; } -- cgit v1.2.1