diff --git a/dmlproc/dmlproc.cpp b/dmlproc/dmlproc.cpp index deb936422..3845ef37a 100644 --- a/dmlproc/dmlproc.cpp +++ b/dmlproc/dmlproc.cpp @@ -492,17 +492,19 @@ void rollbackAll(DBRM* dbrm) dbrm->setSystemReady(true); } -void setupCwd() +int8_t setupCwd() { string workdir = startup::StartUp::tmpDir(); if (workdir.length() == 0) workdir = "."; - (void)chdir(workdir.c_str()); + int8_t rc = chdir(workdir.c_str()); - if (access(".", W_OK) != 0) - (void)chdir("/tmp"); + if (rc < 0 || access(".", W_OK) != 0) + rc = chdir("/tmp"); + + return rc; } } // Namewspace @@ -521,7 +523,18 @@ int main(int argc, char* argv[]) Config* cf = Config::makeConfig(); - setupCwd(); + if ( setupCwd() ) + { + LoggingID logid(21, 0, 0); + logging::Message::Args args1; + logging::Message msg(1); + args1.add("DMLProc couldn't cwd."); + msg.format( args1 ); + logging::Logger logger(logid.fSubsysID); + logger.logMessage(LOG_TYPE_CRITICAL, msg, logid); + return 1; + } + WriteEngine::WriteEngineWrapper::init( WriteEngine::SUBSYSTEM_ID_DMLPROC ); #ifdef _MSC_VER @@ -610,9 +623,20 @@ int main(int argc, char* argv[]) try { string port = cf->getConfig(DMLProc, "Port"); - string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1"; + string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1"; + // Couldn't check the return code b/c + // fuser returns 1 for unused port. +#if defined(__GNUC__) && __GNUC__ >= 5 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" (void)::system(cmd.c_str()); +#pragma GCC diagnostic pop +#else + (void)::system(cmd.c_str()); +#endif + + } catch (...) { diff --git a/oamapps/alarmmanager/CMakeLists.txt b/oamapps/alarmmanager/CMakeLists.txt index 73c069153..a6b12ab75 100644 --- a/oamapps/alarmmanager/CMakeLists.txt +++ b/oamapps/alarmmanager/CMakeLists.txt @@ -8,6 +8,8 @@ set(alarmmanager_LIB_SRCS alarmmanager.cpp alarm.cpp) add_library(alarmmanager SHARED ${alarmmanager_LIB_SRCS}) +target_compile_options(alarmmanager PRIVATE -Wno-unused-result) + set_target_properties(alarmmanager PROPERTIES VERSION 1.0.0 SOVERSION 1) install(TARGETS alarmmanager DESTINATION ${ENGINE_LIBDIR} COMPONENT libs) diff --git a/oamapps/mcsadmin/mcsadmin.cpp b/oamapps/mcsadmin/mcsadmin.cpp index 02a77f56a..c0507aadd 100644 --- a/oamapps/mcsadmin/mcsadmin.cpp +++ b/oamapps/mcsadmin/mcsadmin.cpp @@ -3348,15 +3348,14 @@ int processCommand(string* arguments) for (i = alarmList.begin(); i != alarmList.end(); ++i) { - switch (i->second.getState()) + // SET = 1, CLEAR = 0 + if (i->second.getState() == true) { - case SET: - cout << "SET" << endl; - break; - - case CLEAR: - cout << "CLEAR" << endl; - break; + cout << "SET" << endl; + } + else + { + cout << "CLEAR" << endl; } cout << "AlarmID = " << i->second.getAlarmID() << endl; diff --git a/utils/dataconvert/dataconvert.cpp b/utils/dataconvert/dataconvert.cpp index 311d82e08..0121b57c4 100644 --- a/utils/dataconvert/dataconvert.cpp +++ b/utils/dataconvert/dataconvert.cpp @@ -2429,11 +2429,13 @@ int64_t DataConvert::intToDate(int64_t data) // this snprintf call causes a compiler warning b/c we're potentially copying a 20-digit # // into 15 bytes, however, that appears to be intentional. -#if defined(__GNUC__) && __GNUC__ >= 5 +#if defined(__GNUC__) && __GNUC__ >= 6 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-truncation=" snprintf( buf, 15, "%llu", (long long unsigned int)data); #pragma GCC diagnostic pop +#else + snprintf( buf, 15, "%llu", (long long unsigned int)data); #endif string year, month, day, hour, min, sec, msec; @@ -2563,11 +2565,13 @@ int64_t DataConvert::intToDatetime(int64_t data, bool* date) // this snprintf call causes a compiler warning b/c we're potentially copying a 20-digit # // into 15 bytes, however, that appears to be intentional. -#if defined(__GNUC__) && __GNUC__ >= 5 +#if defined(__GNUC__) && __GNUC__ >= 6 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-truncation=" snprintf( buf, 15, "%llu", (long long unsigned int)data); #pragma GCC diagnostic pop +#else + snprintf( buf, 15, "%llu", (long long unsigned int)data); #endif //string date = buf; @@ -2699,11 +2703,13 @@ int64_t DataConvert::intToTime(int64_t data, bool fromString) // this snprintf call causes a compiler warning b/c we're potentially copying a 20-digit # // into 15 bytes, however, that appears to be intentional. -#if defined(__GNUC__) && __GNUC__ >= 5 +#if defined(__GNUC__) && __GNUC__ >= 6 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-truncation=" snprintf( buf, 15, "%llu", (long long unsigned int)data); #pragma GCC diagnostic pop +#else + snprintf( buf, 15, "%llu", (long long unsigned int)data); #endif //string date = buf; diff --git a/utils/dataconvert/dataconvert.h b/utils/dataconvert/dataconvert.h index b81634639..d563f5fea 100644 --- a/utils/dataconvert/dataconvert.h +++ b/utils/dataconvert/dataconvert.h @@ -675,7 +675,7 @@ inline void DataConvert::timeToString1( long long timevalue, char* buf, unsigned } // this snprintf call causes a compiler warning b/c buffer size is less // then maximum string size. -#if defined(__GNUC__) && __GNUC__ >= 5 +#if defined(__GNUC__) && __GNUC__ >= 6 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-truncation=" snprintf( buf, buflen, "%02d%02d%02d", @@ -684,6 +684,12 @@ inline void DataConvert::timeToString1( long long timevalue, char* buf, unsigned (unsigned)((timevalue >> 14) & 0xff) ); #pragma GCC diagnostic pop +#else + snprintf( buf, buflen, "%02d%02d%02d", + hour, + (unsigned)((timevalue >> 32) & 0xff), + (unsigned)((timevalue >> 14) & 0xff) + ); #endif } diff --git a/utils/messageqcpp/inetstreamsocket.cpp b/utils/messageqcpp/inetstreamsocket.cpp index 1e09c38cf..d94a3eb94 100644 --- a/utils/messageqcpp/inetstreamsocket.cpp +++ b/utils/messageqcpp/inetstreamsocket.cpp @@ -966,12 +966,15 @@ void InetStreamSocket::connect(const sockaddr* serv_addr) char buf = '\0'; (void)::recv(socketParms().sd(), &buf, 1, 0); #else -#if defined(__GNUC__) && __GNUC__ >= 5 +#if defined(__GNUC__) && __GNUC__ >= 6 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-result" char buf = '\0'; - ssize_t bytes = ::read(socketParms().sd(), &buf, 1); // we know 1 byte is in the recv buffer + ::read(socketParms().sd(), &buf, 1); // we know 1 byte is in the recv buffer #pragma GCC diagnostic pop +#else + char buf = '\0'; + ::read(socketParms().sd(), &buf, 1); // we know 1 byte is in the recv buffer #endif // pragma #endif return; diff --git a/utils/threadpool/threadpool.h b/utils/threadpool/threadpool.h index fa6921900..27d87fd12 100644 --- a/utils/threadpool/threadpool.h +++ b/utils/threadpool/threadpool.h @@ -77,7 +77,7 @@ public: boost::thread* create_thread(F threadfunc) { boost::lock_guard guard(m); -#if defined(__GNUC__) && __GNUC__ >= 5 +#if defined(__GNUC__) && __GNUC__ >= 7 std::unique_ptr new_thread(new boost::thread(threadfunc)); #else std::auto_ptr new_thread(new boost::thread(threadfunc)); diff --git a/writeengine/shared/we_chunkmanager.cpp b/writeengine/shared/we_chunkmanager.cpp index e6fa43db1..abe61ab11 100644 --- a/writeengine/shared/we_chunkmanager.cpp +++ b/writeengine/shared/we_chunkmanager.cpp @@ -66,6 +66,8 @@ namespace WriteEngine extern int NUM_BLOCKS_PER_INITIAL_EXTENT; // defined in we_dctnry.cpp extern WErrorCodes ec; // defined in we_log.cpp +const int COMPRESSED_CHUNK_SIZE = compress::IDBCompressInterface::maxCompressedSize(UNCOMPRESSED_CHUNK_SIZE) + 64 + 3 + 8 * 1024; + //------------------------------------------------------------------------------ // Search for the specified chunk in fChunkList. //------------------------------------------------------------------------------ @@ -1926,7 +1928,7 @@ int ChunkManager::reallocateChunks(CompFileData* fileData) char tmText[24]; // this snprintf call causes a compiler warning b/c buffer size is less // then maximum string size. -#if defined(__GNUC__) && __GNUC__ >= 5 +#if defined(__GNUC__) && __GNUC__ >= 6 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-truncation=" snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld", @@ -1934,6 +1936,11 @@ int ChunkManager::reallocateChunks(CompFileData* fileData) ltm.tm_mday, ltm.tm_hour, ltm.tm_min, ltm.tm_sec, tv.tv_usec); #pragma GCC diagnostic pop +#else + snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld", + ltm.tm_year + 1900, ltm.tm_mon + 1, + ltm.tm_mday, ltm.tm_hour, ltm.tm_min, + ltm.tm_sec, tv.tv_usec); #endif string dbgFileName(rlcFileName + tmText); @@ -2116,7 +2123,7 @@ int ChunkManager::reallocateChunks(CompFileData* fileData) char tmText[24]; // this snprintf call causes a compiler warning b/c buffer size is less // then maximum string size. -#if defined(__GNUC__) && __GNUC__ >= 5 +#if defined(__GNUC__) && __GNUC__ >= 6 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-truncation=" snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld", @@ -2124,6 +2131,11 @@ int ChunkManager::reallocateChunks(CompFileData* fileData) ltm.tm_mday, ltm.tm_hour, ltm.tm_min, ltm.tm_sec, tv.tv_usec); #pragma GCC diagnostic pop +#else + snprintf(tmText, sizeof(tmText), ".%04d%02d%02d%02d%02d%02d%06ld", + ltm.tm_year + 1900, ltm.tm_mon + 1, + ltm.tm_mday, ltm.tm_hour, ltm.tm_min, + ltm.tm_sec, tv.tv_usec); #endif string dbgFileName(rlcFileName + tmText); diff --git a/writeengine/shared/we_chunkmanager.h b/writeengine/shared/we_chunkmanager.h index 0d4d013d8..edf9b232f 100644 --- a/writeengine/shared/we_chunkmanager.h +++ b/writeengine/shared/we_chunkmanager.h @@ -68,7 +68,6 @@ const int UNCOMPRESSED_CHUNK_SIZE = compress::IDBCompressInterface::UNCOMPRESSED const int COMPRESSED_FILE_HEADER_UNIT = compress::IDBCompressInterface::HDR_BUF_LEN; // assume UNCOMPRESSED_CHUNK_SIZE > 0xBFFF (49151), 8 * 1024 bytes padding -const int COMPRESSED_CHUNK_SIZE = compress::IDBCompressInterface::maxCompressedSize(UNCOMPRESSED_CHUNK_SIZE) + 64 + 3 + 8 * 1024; const int BLOCKS_IN_CHUNK = UNCOMPRESSED_CHUNK_SIZE / BYTE_PER_BLOCK; const int MAXOFFSET_PER_CHUNK = 511 * BYTE_PER_BLOCK;