dlt_message_free(&msg, verbose);
}
- if (context->user_handle!=0)
+ if (context->user_handle >= DLT_FD_MINIMUM)
{
/* This call also replaces the default values with the values defined for default */
if (dlt_daemon_user_send_log_level(daemon, context, verbose)==-1)
context->trace_status = usercontext->trace_status; /* No endianess conversion necessary */
/* The folowing function sends also the trace status */
- if ((context->user_handle==0) ||
- (dlt_daemon_user_send_log_level(daemon, context, verbose)!=0))
+ if (context->user_handle >= DLT_FD_MINIMUM && dlt_daemon_user_send_log_level(daemon, context, verbose)!=0)
{
context->log_level = old_log_level;
context->trace_status = old_trace_status;
{
if (daemon->applications[i].user_handle==fd)
{
- daemon->applications[i].user_handle = 0;
+ daemon->applications[i].user_handle = DLT_FD_INIT;
}
}
application->pid = pid;
application->application_description = 0;
application->num_contexts = 0;
- application->user_handle = -1;
+ application->user_handle = DLT_FD_INIT;
new_application = 1;
}
}
- if( application->user_handle != -1 )
+ if( application->user_handle != DLT_FD_INIT )
{
if( application->pid != pid )
{
dlt_log(LOG_ERR, str);
}
- application->user_handle = -1;
+ application->user_handle = DLT_FD_INIT;
application->pid = pid;
}
}
/* open user pipe only if it is not yet opened */
- if (application->user_handle==-1 && pid!=0)
+ if (application->user_handle==DLT_FD_INIT && pid!=0)
{
sprintf(filename,"%s/dlt%d",DLT_USER_DIR,application->pid);
if (daemon->num_applications>0)
{
/* Check if user handle is open; if yes, close it */
- if (application->user_handle!=-1)
+ if (application->user_handle >= DLT_FD_MINIMUM)
{
close(application->user_handle);
- application->user_handle=-1;
+ application->user_handle=DLT_FD_INIT;
}
/* Free description of application to be deleted */
{
if (daemon->contexts[i].user_handle==fd)
{
- daemon->contexts[i].user_handle = 0;
+ daemon->contexts[i].user_handle = DLT_FD_INIT;
}
}
{
/* Close connection */
close(context->user_handle);
- context->user_handle=0;
+ context->user_handle=DLT_FD_INIT;
}
}
{
/* Close connection */
close(app->user_handle);
- app->user_handle=0;
+ app->user_handle=DLT_FD_INIT;
}
}
{
/* Close connection */
close(context->user_handle);
- context->user_handle=0;
+ context->user_handle=DLT_FD_INIT;
}
dlt_daemon_control_service_response(sock, daemon, id, DLT_SERVICE_RESPONSE_ERROR, verbose);
}
old_log_level = context->log_level;
context->log_level = req->log_level; /* No endianess conversion necessary*/
- if ((context->user_handle!=0) &&
+ if ((context->user_handle >= DLT_FD_MINIMUM) &&
(dlt_daemon_user_send_log_level(daemon, context, verbose)==0))
{
dlt_daemon_control_service_response(sock, daemon, id, DLT_SERVICE_RESPONSE_OK, verbose);
old_trace_status = context->trace_status;
context->trace_status = req->log_level; /* No endianess conversion necessary */
- if ((context->user_handle!=0) &&
+ if ((context->user_handle >= DLT_FD_MINIMUM ) &&
(dlt_daemon_user_send_log_level(daemon, context, verbose)==0))
{
dlt_daemon_control_service_response(sock, daemon, id, DLT_SERVICE_RESPONSE_OK, verbose);
if ((context->log_level == DLT_LOG_DEFAULT) ||
(context->trace_status == DLT_TRACE_STATUS_DEFAULT))
{
- if (context->user_handle!=0)
+ if (context->user_handle >= DLT_FD_MINIMUM)
{
if (dlt_daemon_user_send_log_level(daemon, context, verbose)==-1)
{
if (app)
{
- if (app->user_handle!=0)
+ if (app->user_handle >= DLT_FD_MINIMUM)
{
if (dlt_daemon_user_send_log_state(daemon, app, verbose)==-1)
{
}
dlt_user.dlt_user_handle = open(filename, O_RDWR | O_CLOEXEC);
- if (dlt_user.dlt_user_handle == -1)
+ if (dlt_user.dlt_user_handle == DLT_FD_INIT)
{
sprintf(str,"Loging disabled, FIFO user %s cannot be opened!\n",filename);
dlt_log(LOG_WARNING, str);
dlt_user.log_state = -1;
dlt_user.dlt_log_handle=-1;
- dlt_user.dlt_user_handle=-1;
+ dlt_user.dlt_user_handle=DLT_FD_INIT;
dlt_set_id(dlt_user.ecuID,DLT_USER_DEFAULT_ECU_ID);
dlt_set_id(dlt_user.appID,"");
pthread_cancel(dlt_receiverthread_handle);
}
- if (dlt_user.dlt_user_handle!=-1)
+ if (dlt_user.dlt_user_handle!=DLT_FD_INIT)
{
sprintf(filename,"%s/dlt%d",DLT_USER_DIR,getpid());
close(dlt_user.dlt_user_handle);
- dlt_user.dlt_user_handle=-1;
+ dlt_user.dlt_user_handle=DLT_FD_INIT;
unlink(filename);
}
delayed_injection_callback.injection_callback = 0;
delayed_injection_callback.service_id = 0;
- if (dlt_user.dlt_user_handle!=-1)
+ if (dlt_user.dlt_user_handle!=DLT_FD_INIT)
{
while (1)
{