summaryrefslogtreecommitdiff
path: root/src/console/dlt-receive.c
diff options
context:
space:
mode:
authorManikandanC <Manikandan.Chockalingam@in.bosch.com>2017-10-06 11:37:31 +0530
committerChristoph Lipka <clipka@users.noreply.github.com>2018-11-30 12:17:59 +0100
commit73180fc762f015935950f697822710af3f5bd23d (patch)
treeffcd8407d8ab55d63544af33ade7efd120381728 /src/console/dlt-receive.c
parent13803189600c724341148af34f33688497d71991 (diff)
downloadDLT-daemon-73180fc762f015935950f697822710af3f5bd23d.tar.gz
Use poll in the dlt-daemon for POSIX compliance
The poll system call is now used in the daemon to enable DLT use in POSIX compliant systems. Also added introduced new unregister_app macro to avoid missing of logs in startup buffer. Signed-off-by: Frederic Berat <fberat@de.adit-jv.com> Signed-off-by: ManikandanC <Manikandan.Chockalingam@in.bosch.com> Signed-off-by: Saya Sugiura <ssugiura@jp.adit-jv.com> Signed-off-by: S. Hameed <shameed@jp.adit-jv.com>
Diffstat (limited to 'src/console/dlt-receive.c')
-rw-r--r--src/console/dlt-receive.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/console/dlt-receive.c b/src/console/dlt-receive.c
index 200add1..e22d15e 100644
--- a/src/console/dlt-receive.c
+++ b/src/console/dlt-receive.c
@@ -77,7 +77,11 @@
#include <string.h>
#include <glob.h>
#include <syslog.h>
-#include <linux/limits.h> /* for PATH_MAX */
+#ifdef __linux__
+#include <linux/limits.h>
+#else
+#include <limits.h>
+#endif
#include <inttypes.h>
#include "dlt_client.h"
@@ -211,7 +215,7 @@ int dlt_receive_open_output_file(DltReceiveData * dltdata)
{
/* if (file_already_exists) */
glob_t outer;
- if (glob(dltdata->ovalue, GLOB_TILDE_CHECK | GLOB_NOSORT, NULL, &outer) == 0)
+ if (glob(dltdata->ovalue, GLOB_TILDE | GLOB_NOSORT, NULL, &outer) == 0)
{
if (dltdata->vflag)
{
@@ -234,7 +238,7 @@ int dlt_receive_open_output_file(DltReceiveData * dltdata)
* foo.1000.dlt
* foo.11.dlt
*/
- if (glob(pattern, GLOB_TILDE_CHECK | GLOB_NOSORT, NULL, &inner) == 0)
+ if (glob(pattern, GLOB_TILDE | GLOB_NOSORT, NULL, &inner) == 0)
{
/* search for the highest number used */
size_t i;
@@ -376,7 +380,16 @@ int main(int argc, char* argv[])
to_copy = to_copy - 4;
}
- dltdata.ovaluebase = strndup(dltdata.ovalue, to_copy);
+ dltdata.ovaluebase = (char *)calloc(1, to_copy + 1);
+
+ if (dltdata.ovaluebase == NULL)
+ {
+ fprintf (stderr, "Memory allocation failed.\n");
+ return -1;
+ }
+
+ dltdata.ovaluebase[to_copy] = '\0';
+ memcpy(dltdata.ovaluebase, dltdata.ovalue, to_copy);
break;
}
case 'e':