diff options
author | Simon Brandner <simon.brandner@partner.bmw.de> | 2012-12-03 17:49:49 +0100 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2013-07-19 16:54:04 +0200 |
commit | 311b8896c144c5ff8c10dbc0d4c7832720292608 (patch) | |
tree | 8f176477d72e254fb2347697262701b133f2937f /src/daemon/dlt_daemon_common.c | |
parent | 0790eaebe0dfea27bd0f871e19af752d10bf8938 (diff) | |
download | DLT-daemon-311b8896c144c5ff8c10dbc0d4c7832720292608.tar.gz |
Removed most warnings caused by: Wunused-but-set-variable flag. Eome were kept, because they were the nicer variant to eliminate them, or they seemed reserved for an commandline argument
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/daemon/dlt_daemon_common.c')
-rw-r--r-- | src/daemon/dlt_daemon_common.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/daemon/dlt_daemon_common.c b/src/daemon/dlt_daemon_common.c index 3e24475..7bbce7b 100644 --- a/src/daemon/dlt_daemon_common.c +++ b/src/daemon/dlt_daemon_common.c @@ -485,6 +485,12 @@ int dlt_daemon_applications_load(DltDaemon *daemon,const char *filename, int ver /* Get line */ ret=fgets(buf,sizeof(buf),fd); + if (NULL == ret) + { + snprintf(str,DLT_DAEMON_COMMON_TEXTBUFSIZE, "dlt_daemon_applications_load fgets(buf,sizeof(buf),fd) returned NULL"); + dlt_log(LOG_ERR, str); + return -1;//seems to be appropriate, but not sure. !feof is already a precondition, so another problem should the reason! + } if (strcmp(buf,"")!=0) { @@ -824,6 +830,13 @@ int dlt_daemon_contexts_load(DltDaemon *daemon,const char *filename, int verbose /* Get line */ ret=fgets(buf,sizeof(buf),fd); + if (NULL == ret) + { + sprintf(str,"dlt_daemon_contexts_load: fgets(buf,sizeof(buf),fd);"); + dlt_log(LOG_ERR, str); + fclose(fd); + return -1;//as we are not eof, there seems to be another problem. + } if (strcmp(buf,"")!=0) { @@ -2122,7 +2135,7 @@ void dlt_daemon_control_send_ecu_version(int sock, DltDaemon *daemon, const char { DltMessage msg; uint32_t len; - DltServiceGetSoftwareVersionResponse *resp; + DltServiceGetSoftwareVersionResponse *resp; PRINT_FUNCTION_VERBOSE(verbose); @@ -2254,11 +2267,29 @@ void dlt_daemon_control_send_control_message( int sock, DltDaemon *daemon, DltMe if (daemon->sendserialheader) { ret=write(sock,dltSerialHeader,sizeof(dltSerialHeader)); + if (0 > ret) + { + dlt_log(LOG_CRIT,"dlt_daemon_control_send_control_message: write dltSerialHeader failed\n"); + DLT_DAEMON_SEM_FREE(); + return; + } } /* Send data */ ret=write(sock, msg->headerbuffer+sizeof(DltStorageHeader),msg->headersize-sizeof(DltStorageHeader)); + if (0 > ret) + { + dlt_log(LOG_CRIT,"dlt_daemon_control_send_control_message: write msg->headerbuffer failed\n"); + DLT_DAEMON_SEM_FREE(); + return; + } ret=write(sock, msg->databuffer,msg->datasize); + if (0 > ret) + { + dlt_log(LOG_CRIT,"dlt_daemon_control_send_control_message: write msg->databuffer failed\n"); + DLT_DAEMON_SEM_FREE(); + return; + } DLT_DAEMON_SEM_FREE(); } @@ -2485,7 +2516,15 @@ void dlt_daemon_control_message_time(int sock, DltDaemon *daemon, int verbose) /* Send data */ ret=write(sock, msg.headerbuffer+sizeof(DltStorageHeader),msg.headersize-sizeof(DltStorageHeader)); if(msg.datasize > 0) - ret=write(sock, msg.databuffer,msg.datasize); + { + ret=write(sock, msg.databuffer,msg.datasize); + if (0 > ret){ + dlt_log(LOG_CRIT,"dlt_daemon_control_message_time: Failed to write databuffer\n"); + dlt_message_free(&msg,0); + DLT_DAEMON_SEM_FREE(); + return; + } + } DLT_DAEMON_SEM_FREE(); } |