summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLassi Marttala <Lassi.LM.Marttala@partner.bmw.de>2013-01-25 13:56:08 +0100
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2013-07-19 16:54:21 +0200
commit06d85034559e3d7fd7a10e1caaa77fe79bf25a68 (patch)
tree572c57690f04bcb798dfba9b0b38266283556f3e
parent78e1afcc7a1e0f3f7103ee242bdd08c1bef755ee (diff)
downloadDLT-daemon-06d85034559e3d7fd7a10e1caaa77fe79bf25a68.tar.gz
Fix compiler warnings
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
-rw-r--r--src/daemon/dlt-daemon.c16
-rwxr-xr-xsrc/examples/dlt-example-user-func.c7
-rwxr-xr-xsrc/examples/dlt-example-user.c7
-rwxr-xr-xsrc/shared/dlt_common.c7
-rw-r--r--src/system/dlt-system-filetransfer.c2
-rw-r--r--src/system/dlt-system-watchdog.c6
-rwxr-xr-xsrc/tests/dlt-test-multi-process.c2
7 files changed, 19 insertions, 28 deletions
diff --git a/src/daemon/dlt-daemon.c b/src/daemon/dlt-daemon.c
index ca45aab..9405e6e 100644
--- a/src/daemon/dlt-daemon.c
+++ b/src/daemon/dlt-daemon.c
@@ -1066,7 +1066,8 @@ void dlt_daemon_signal_handler(int sig)
void dlt_daemon_daemonize(int verbose)
{
- int i,lfp,bytes_written,ret;
+ int i,lfp;
+ ssize_t pid_len;
PRINT_FUNCTION_VERBOSE(verbose);
@@ -1103,14 +1104,17 @@ void dlt_daemon_daemonize(int verbose)
/* Open standard descriptors stdin, stdout, stderr */
i=open("/dev/null",O_RDWR); /* open stdin */
- ret=dup(i); /* stdout */
- ret=dup(i); /* stderr */
+ if(dup(i) < 0)
+ dlt_log(LOG_ERR, "Failed to direct stdout to /dev/null.\n");/* stdout */
+ if(dup(i) < 0)
+ dlt_log(LOG_ERR, "Failed to direct stderr to /dev/null.\n"); /* stderr */
/* Set umask */
umask(DLT_DAEMON_UMASK);
/* Change to known directory */
- ret=chdir(DLT_USER_DIR);
+ if(chdir(DLT_USER_DIR) < 0)
+ dlt_log(LOG_ERR, "Failed to chdir to DLT_USER_DIR.\n");;
/* Ensure single copy of daemon;
run only one instance at a time */
@@ -1128,7 +1132,9 @@ void dlt_daemon_daemonize(int verbose)
/* only first instance continues */
sprintf(str,"%d\n",getpid());
- bytes_written=write(lfp,str,strlen(str)); /* record pid to lockfile */
+ pid_len = strlen(str);
+ if(write(lfp,str,pid_len) != pid_len) /* record pid to lockfile */
+ dlt_log(LOG_ERR, "Could not write pid to file in dlt_daemon_daemonize.\n");
/* Catch signals */
signal(SIGCHLD,SIG_IGN); /* ignore child */
diff --git a/src/examples/dlt-example-user-func.c b/src/examples/dlt-example-user-func.c
index 100d0c1..c0adff1 100755
--- a/src/examples/dlt-example-user-func.c
+++ b/src/examples/dlt-example-user-func.c
@@ -90,7 +90,6 @@ void usage()
printf("Generate DLT messages and store them to file or send them to daemon.\n");
printf("%s \n", version);
printf("Options:\n");
- printf(" -v Verbose mode\n");
printf(" -d delay Milliseconds to wait between sending messages (Default: 500)\n");
printf(" -f filename Use local log file instead of sending to daemon\n");
printf(" -n count Number of messages to be generated (Default: 10)\n");
@@ -103,7 +102,6 @@ void usage()
*/
int main(int argc, char* argv[])
{
- int vflag = 0;
int gflag = 0;
int aflag = 0;
char *dvalue = 0;
@@ -123,11 +121,6 @@ int main(int argc, char* argv[])
{
switch (c)
{
- case 'v':
- {
- vflag = 1;
- break;
- }
case 'g':
{
gflag = 1;
diff --git a/src/examples/dlt-example-user.c b/src/examples/dlt-example-user.c
index afe2be0..2127445 100755
--- a/src/examples/dlt-example-user.c
+++ b/src/examples/dlt-example-user.c
@@ -90,7 +90,6 @@ void usage()
printf("Generate DLT messages and store them to file or send them to daemon.\n");
printf("%s \n", version);
printf("Options:\n");
- printf(" -v Verbose mode\n");
printf(" -d delay Milliseconds to wait between sending messages (Default: 500)\n");
printf(" -f filename Use local log file instead of sending to daemon\n");
printf(" -n count Number of messages to be generated (Default: 10)\n");
@@ -109,7 +108,6 @@ void usage()
*/
int main(int argc, char* argv[])
{
- int vflag = 0;
int gflag = 0;
int aflag = 0;
#ifdef DLT_TEST_ENABLE
@@ -141,11 +139,6 @@ int main(int argc, char* argv[])
{
switch (c)
{
- case 'v':
- {
- vflag = 1;
- break;
- }
case 'g':
{
gflag = 1;
diff --git a/src/shared/dlt_common.c b/src/shared/dlt_common.c
index 3e7e498..7e9d852 100755
--- a/src/shared/dlt_common.c
+++ b/src/shared/dlt_common.c
@@ -3182,7 +3182,6 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
float64_t value64f=0,value64f_tmp=0;
int64_t value64f_tmp_int64i=0,value64f_tmp_int64i_swaped=0;
- //uint32_t quantisation=0,
uint32_t quantisation_tmp=0;
if (type_info & DLT_TYPE_INFO_STRG)
@@ -3238,7 +3237,7 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
return -1;
sprintf(text+strlen(text),"%d",value8u);
}
- else if (type_info & DLT_TYPE_INFO_SINT || type_info & DLT_TYPE_INFO_UINT)
+ else if ((type_info & DLT_TYPE_INFO_SINT) || (type_info & DLT_TYPE_INFO_UINT))
{
/* signed or unsigned argument received */
if (type_info & DLT_TYPE_INFO_VARI)
@@ -3262,15 +3261,11 @@ int dlt_message_argument_print(DltMessage *msg,uint32_t type_info,uint8_t **ptr,
}
if (type_info & DLT_TYPE_INFO_FIXP)
{
- //quantisation=0;
- quantisation_tmp=0;
//compiler warning: variable ‘quantisation_tmp’ set but not used [-Wunused-but-set-variable], but: DLT_MSG_READ_VALUE wants a parameter, "0" does not work
DLT_MSG_READ_VALUE(quantisation_tmp,*ptr,*datalength,uint32_t);
if((*datalength)<0)
return -1;
- //quantisation=DLT_ENDIAN_GET_32(msg->standardheader->htyp, quantisation_tmp);
-
switch ( type_info & DLT_TYPE_INFO_TYLE)
{
case DLT_TYLE_8BIT:
diff --git a/src/system/dlt-system-filetransfer.c b/src/system/dlt-system-filetransfer.c
index d0ff7c7..64ac487 100644
--- a/src/system/dlt-system-filetransfer.c
+++ b/src/system/dlt-system-filetransfer.c
@@ -659,7 +659,7 @@ int wait_for_files(FiletransferOptions const *opts)
struct inotify_event *ie = (struct inotify_event *)&buf[i];
if(ie->len > 0)
{
- if(ie->mask & IN_CLOSE_WRITE || ie->mask & IN_MOVED_TO)
+ if((ie->mask & IN_CLOSE_WRITE) || (ie->mask & IN_MOVED_TO))
{
int j;
for(j = 0;j < opts->Count;j++)
diff --git a/src/system/dlt-system-watchdog.c b/src/system/dlt-system-watchdog.c
index 5eef59b..a45ef30 100644
--- a/src/system/dlt-system-watchdog.c
+++ b/src/system/dlt-system-watchdog.c
@@ -66,7 +66,11 @@ void wait_period (PeriodicData *info)
{
unsigned long long missed;
- read (info->timer_fd, &missed, sizeof (missed));
+ if(read (info->timer_fd, &missed, sizeof (missed)) < 0)
+ {
+ DLT_LOG(watchdogContext, DLT_LOG_ERROR,
+ DLT_STRING("Could not read from timer file descriptor in watchdog.\n"));
+ }
if (missed > 0)
{
diff --git a/src/tests/dlt-test-multi-process.c b/src/tests/dlt-test-multi-process.c
index f9706d9..e5dfcea 100755
--- a/src/tests/dlt-test-multi-process.c
+++ b/src/tests/dlt-test-multi-process.c
@@ -236,8 +236,8 @@ void do_forks(s_parameters params)
fprintf(stderr, "Could not allocate memory for child process' kernel structure.\n");
cleanup();
abort();
- return;//for parasoft
}
+ break;
case 0: // Child process, start threads
run_threads(params);
break;