diff options
author | ManikandanC <Manikandan.Chockalingam@in.bosch.com> | 2017-10-06 11:37:31 +0530 |
---|---|---|
committer | Christoph Lipka <clipka@users.noreply.github.com> | 2018-11-30 12:17:59 +0100 |
commit | 73180fc762f015935950f697822710af3f5bd23d (patch) | |
tree | ffcd8407d8ab55d63544af33ade7efd120381728 /src/console/logstorage/dlt-logstorage-list.c | |
parent | 13803189600c724341148af34f33688497d71991 (diff) | |
download | DLT-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/logstorage/dlt-logstorage-list.c')
-rw-r--r-- | src/console/logstorage/dlt-logstorage-list.c | 17 |
1 files changed, 16 insertions, 1 deletions
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; |