From 73180fc762f015935950f697822710af3f5bd23d Mon Sep 17 00:00:00 2001 From: ManikandanC Date: Fri, 6 Oct 2017 11:37:31 +0530 Subject: 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 Signed-off-by: ManikandanC Signed-off-by: Saya Sugiura Signed-off-by: S. Hameed --- src/console/logstorage/dlt-logstorage-list.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/console/logstorage/dlt-logstorage-list.c') diff --git a/src/console/logstorage/dlt-logstorage-list.c b/src/console/logstorage/dlt-logstorage-list.c index 0b7a8c0..a18fca6 100644 --- a/src/console/logstorage/dlt-logstorage-list.c +++ b/src/console/logstorage/dlt-logstorage-list.c @@ -143,6 +143,7 @@ static struct LogstorageDeviceInfo *logstorage_find_dev_info(const char *node) int logstorage_store_dev_info(const char *node, const char *path) { struct LogstorageDeviceInfo *ptr = NULL; + size_t path_len = 0; if ((node == NULL) || (path == NULL)) { @@ -166,7 +167,21 @@ int logstorage_store_dev_info(const char *node, const char *path) } ptr->dev_node = strdup(node); - ptr->mnt_point = strndup(path, DLT_MOUNT_PATH_MAX); + path_len = strlen(path); + if (path_len >DLT_MOUNT_PATH_MAX) + { + path_len = (size_t)DLT_MOUNT_PATH_MAX; + } + ptr->mnt_point = (char *)calloc(1, path_len + 1); + + if (ptr->mnt_point == NULL) + { + pr_error("memory allocation failed for mnt_point\n"); + return -1; + } + + ptr->mnt_point[path_len] = '\0'; + memcpy(ptr->mnt_point, path, path_len); /* Put it on head */ ptr->next = g_info; -- cgit v1.2.1