changeset 276:5d5beb9883df

Bug 3759: HeapStats Agent could not be built on CentOS 6 Reviewed-by: ykubota https://github.com/HeapStats/heapstats/pull/149
author Yasumasa Suenaga <yasuenag@gmail.com>
date Tue, 08 Oct 2019 23:12:56 +0900
parents e75ae2bc501e
children ebbca28d3efd
files ChangeLog agent/src/heapstats-engines/fsUtil.cpp agent/src/heapstats-engines/logManager.cpp
diffstat 3 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Oct 07 21:16:19 2019 +0900
+++ b/ChangeLog	Tue Oct 08 23:12:56 2019 +0900
@@ -1,3 +1,7 @@
+2019-10-08 Yasumasa Suenaga <yasuenag@gmail.com>
+
+	* Bug 3759: HeapStats Agent could not be built on CentOS 6
+
 2019-10-07 Yasumasa Suenaga <yasuenag@gmail.com>
 
 	* Bug 3757: Update SPEC for modularity
--- a/agent/src/heapstats-engines/fsUtil.cpp	Mon Oct 07 21:16:19 2019 +0900
+++ b/agent/src/heapstats-engines/fsUtil.cpp	Tue Oct 08 23:12:56 2019 +0900
@@ -350,6 +350,8 @@
  * \param isDirectory [in] Path is directory.
  * \return Unique path.<br>Don't forget deallocate.
  */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
 char *createUniquePath(char *path, bool isDirectory) {
   /* Variable for temporary path. */
   char tempPath[PATH_MAX] = {0};
@@ -369,8 +371,6 @@
   /* Search extension. */
   char *extPos = strrchr(path, '.');
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wstringop-truncation"
   /* If create path for file and exists extension. */
   if (!isDirectory && extPos != NULL) {
     int pathSize = (extPos - path);
@@ -386,7 +386,6 @@
 
   /* Copy default path. */
   strncpy(tempPath, path, PATH_MAX);
-#pragma GCC diagnostic pop
 
   /* Try make unique path loop. */
   const unsigned long int MAX_RETRY_COUNT = 1000000;
@@ -460,6 +459,7 @@
 
   return result;
 }
+#pragma GCC diagnostic pop
 
 /*!
  * \brief Get parent directory path.
--- a/agent/src/heapstats-engines/logManager.cpp	Mon Oct 07 21:16:19 2019 +0900
+++ b/agent/src/heapstats-engines/logManager.cpp	Tue Oct 08 23:12:56 2019 +0900
@@ -1428,6 +1428,8 @@
  *         Don't forget deallocate memory.<br>
  *         Process is failure, if value is null.
  */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
 char *TLogManager::createArchiveName(TMSecTime nowTime) {
   time_t nowTimeSec = 0;
   struct tm time_struct = {0};
@@ -1436,8 +1438,6 @@
   char extPart[PATH_MAX] = {0};
   char namePart[PATH_MAX] = {0};
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wstringop-truncation"
   /* Search extension. */
   char *archiveFileName = conf->ArchiveFile()->get();
   char *extPos = strrchr(archiveFileName, '.');
@@ -1449,7 +1449,6 @@
     /* Not found extension in path. */
     strncpy(namePart, archiveFileName, PATH_MAX);
   }
-#pragma GCC diagnostic pop
 
   /* Get now datetime and convert to string. */
   nowTimeSec = (time_t)(nowTime / 1000);
@@ -1466,3 +1465,4 @@
   /* Create unique file name. */
   return createUniquePath(arcName, false);
 }
+#pragma GCC diagnostic pop