changeset 275:7fc6aaa87a07

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 Mon, 11 Nov 2019 22:37:55 +0900
parents fa115df256ab
children e9b59376ff6b
files ChangeLog agent/src/heapstats-engines/fsUtil.cpp agent/src/heapstats-engines/logManager.cpp
diffstat 3 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Nov 11 21:08:24 2019 +0900
+++ b/ChangeLog	Mon Nov 11 22:37:55 2019 +0900
@@ -2,6 +2,7 @@
 
 	* Bug 3764: Agent thread might not be stopped when it works
 	* Bug 3767: Compiler warnings at `snmp_session::remote_port`
+	* Bug 3759: HeapStats Agent could not be built on CentOS 6
 
 2019-11-10 Yasumasa Suenaga <yasuenag@gmail.com>
 
--- a/agent/src/heapstats-engines/fsUtil.cpp	Mon Nov 11 21:08:24 2019 +0900
+++ b/agent/src/heapstats-engines/fsUtil.cpp	Mon Nov 11 22:37:55 2019 +0900
@@ -346,6 +346,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};
@@ -365,8 +367,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);
@@ -382,7 +382,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;
@@ -456,6 +455,7 @@
 
   return result;
 }
+#pragma GCC diagnostic pop
 
 /*!
  * \brief Get parent directory path.
--- a/agent/src/heapstats-engines/logManager.cpp	Mon Nov 11 21:08:24 2019 +0900
+++ b/agent/src/heapstats-engines/logManager.cpp	Mon Nov 11 22:37:55 2019 +0900
@@ -1425,6 +1425,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};
@@ -1433,8 +1435,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, '.');
@@ -1446,7 +1446,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);
@@ -1463,3 +1462,4 @@
   /* Create unique file name. */
   return createUniquePath(arcName, false);
 }
+#pragma GCC diagnostic pop