summaryrefslogtreecommitdiffstats
path: root/log_library/client/src/loglibrarylog.c
diff options
context:
space:
mode:
Diffstat (limited to 'log_library/client/src/loglibrarylog.c')
-rw-r--r--log_library/client/src/loglibrarylog.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/log_library/client/src/loglibrarylog.c b/log_library/client/src/loglibrarylog.c
index f2009354..7aa7c2b6 100644
--- a/log_library/client/src/loglibrarylog.c
+++ b/log_library/client/src/loglibrarylog.c
@@ -1,5 +1,5 @@
/*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ int
LOGLIBRARYLOG_Freeze(void) {
int fd;
int *pmap;
+ int ret;
fd = shm_open(FRAMEWORKUNIFIEDLOG_SHARED_MEM_NAME, O_RDWR | O_CREAT, S_IRWXU | S_IRWXO);
if (fd == -1) {
@@ -36,6 +37,13 @@ LOGLIBRARYLOG_Freeze(void) {
return -1;
}
+ ret = ftruncate(fd, sizeof(int));
+ if (ret == 0) {
+ fprintf(stderr, "[%s:L%d]ftruncate() error(%d)\n", __FUNCTION__, __LINE__, ret);
+ close(fd);
+ return -1;
+ }
+
pmap = mmap(NULL, sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
close(fd);
if (pmap == MAP_FAILED) {