# HG changeset patch # User Yasumasa Suenaga # Date 1573479475 -32400 # Node ID 7fc6aaa87a07414f1550d0e125abcd5b9cfddfd3 # Parent fa115df256ab0780c03c0c11eae51440426fce74 Bug 3759: HeapStats Agent could not be built on CentOS 6 Reviewed-by: ykubota https://github.com/HeapStats/heapstats/pull/149 diff -r fa115df256ab -r 7fc6aaa87a07 ChangeLog --- 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 diff -r fa115df256ab -r 7fc6aaa87a07 agent/src/heapstats-engines/fsUtil.cpp --- 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.
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. diff -r fa115df256ab -r 7fc6aaa87a07 agent/src/heapstats-engines/logManager.cpp --- 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.
* 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