From 6d4c5e19aea5b2ffca42549355eb69438518d83c Mon Sep 17 00:00:00 2001 From: stefanocasazza Date: Tue, 12 Sep 2017 18:56:56 +0200 Subject: [PATCH] fix --- include/ulib/base/utility.h | 2 +- include/ulib/notifier.h | 2 +- src/ulib/base/zip/ziptool.c | 2 ++ src/ulib/db/cdb.cpp | 2 ++ src/ulib/dynamic/plugin.cpp | 2 ++ src/ulib/log.cpp | 6 ++++-- src/ulib/net/server/plugin/mod_fcgi.cpp | 4 ++++ src/ulib/net/server/plugin/mod_ssi.cpp | 2 +- src/ulib/net/server/server.cpp | 21 ++++++--------------- src/ulib/notifier.cpp | 4 ++-- src/ulib/utility/uhttp.cpp | 10 +++++++--- 11 files changed, 32 insertions(+), 25 deletions(-) diff --git a/include/ulib/base/utility.h b/include/ulib/base/utility.h index 8c172dbf..e8309712 100644 --- a/include/ulib/base/utility.h +++ b/include/ulib/base/utility.h @@ -156,7 +156,7 @@ static inline uint8_t u_loadavg(const char* buffer) * Output range: [2..2147483648] */ -static inline uint64_t u_nextPowerOfTwo(uint32_t n) +static inline uint32_t u_nextPowerOfTwo(uint32_t n) { U_INTERNAL_TRACE("u_nextPowerOfTwo(%u)", n) diff --git a/include/ulib/notifier.h b/include/ulib/notifier.h index 3be23d19..1db5ffb9 100644 --- a/include/ulib/notifier.h +++ b/include/ulib/notifier.h @@ -249,7 +249,7 @@ protected: static bool setHandler(int fd); private: - static void handlerDelete(int fd, int mask); + static void handlerDelete(unsigned int fd, int mask); #ifndef USE_LIBEVENT static void notifyHandlerEvent() U_NO_EXPORT; diff --git a/src/ulib/base/zip/ziptool.c b/src/ulib/base/zip/ziptool.c index 3298b80f..4477ceed 100644 --- a/src/ulib/base/zip/ziptool.c +++ b/src/ulib/base/zip/ziptool.c @@ -1000,7 +1000,9 @@ unsigned zip_extract(const char* zipfile, const char** files, char*** filenames, ze.crc = crc32(ze.crc, (Bytef*)rd_buff, rdamt); +# ifndef U_COVERITY_FALSE_POSITIVE // NEGATIVE_RETURNS (void) write(f_fd, rd_buff, rdamt); +# endif out_a += rdamt; in_a -= rdamt; diff --git a/src/ulib/db/cdb.cpp b/src/ulib/db/cdb.cpp index e707e58b..e260d1b2 100644 --- a/src/ulib/db/cdb.cpp +++ b/src/ulib/db/cdb.cpp @@ -975,7 +975,9 @@ U_EXPORT istream& operator>>(istream& is, UCDB& cdb) { u_put_unaligned32(hr->dlen, dlen); +# ifndef U_COVERITY_FALSE_POSITIVE // TAINTED_SCALAR is.read(ptr, dlen); +# endif U_INTERNAL_DUMP("data = %.*S", dlen, ptr) diff --git a/src/ulib/dynamic/plugin.cpp b/src/ulib/dynamic/plugin.cpp index 5a3d3273..97cba52f 100644 --- a/src/ulib/dynamic/plugin.cpp +++ b/src/ulib/dynamic/plugin.cpp @@ -17,6 +17,7 @@ void* UPlugIn::create(const char* name, uint32_t name_len) { U_TRACE(0, "UPlugIn::create(%.*S,%u)", name_len, name, name_len) +#ifndef U_COVERITY_FALSE_POSITIVE HINSTANCE handle = UDynamic::dload(name, name_len); if (handle) @@ -36,6 +37,7 @@ void* UPlugIn::create(const char* name, uint32_t name_len) return obj; } } +#endif return U_NULLPTR; } diff --git a/src/ulib/log.cpp b/src/ulib/log.cpp index 51237684..fff9dce5 100644 --- a/src/ulib/log.cpp +++ b/src/ulib/log.cpp @@ -479,7 +479,9 @@ void ULog::write(const struct iovec* iov, int n) if (file_ptr <= log_gzip_sz) { +# ifndef U_COVERITY_FALSE_POSITIVE // FORWARD_NULL checkForLogRotateDataToWrite(); // check if there are previous data to write +# endif ptr_log_data->gzip_len = u_gz_deflate(UFile::map, file_ptr, (char*)ptr_log_data+sizeof(log_data), true); @@ -682,7 +684,7 @@ void ULog::log(const struct iovec* iov, const char* type, int ncount, const char ptr = buffer1; } - len = (UServer_Base::mod_name[0] ? u__snprintf(buffer2, sizeof(buffer2), U_CONSTANT_TO_PARAM("%s"), UServer_Base::mod_name) : 0); + len = (UServer_Base::mod_name[0][0] ? u__snprintf(buffer2, sizeof(buffer2), U_CONSTANT_TO_PARAM("%s"), UServer_Base::mod_name) : 0); len += u__snprintf(buffer2+len, sizeof(buffer2)-len, U_CONSTANT_TO_PARAM("send %s (%u bytes) %.*s%#.*S"), type, ncount, msg_len, msg, sz, ptr); va_list argp; @@ -720,7 +722,7 @@ void ULog::logResponse(const UString& data, const char* format, uint32_t fmt_siz U_INTERNAL_DUMP("u_printf_string_max_length = %d", u_printf_string_max_length) - len = (UServer_Base::mod_name[0] ? u__snprintf(buffer, sizeof(buffer), U_CONSTANT_TO_PARAM("%s"), UServer_Base::mod_name) : 0); + len = (UServer_Base::mod_name[0][0] ? u__snprintf(buffer, sizeof(buffer), U_CONSTANT_TO_PARAM("%s"), UServer_Base::mod_name) : 0); len += u__snprintf(buffer-len, sizeof(buffer)-len, U_CONSTANT_TO_PARAM("received response (%u bytes) %#.*S"), sz, sz, ptr); va_list argp; diff --git a/src/ulib/net/server/plugin/mod_fcgi.cpp b/src/ulib/net/server/plugin/mod_fcgi.cpp index 1e73f11d..9841f67a 100644 --- a/src/ulib/net/server/plugin/mod_fcgi.cpp +++ b/src/ulib/net/server/plugin/mod_fcgi.cpp @@ -236,11 +236,15 @@ int UFCGIPlugIn::handlerInit() UHTTP::valias->push_back(*UString::str_nostat); environment_type = (UHTTP::fcgi_uri_mask->equal(U_CONSTANT_TO_PARAM("*.php")) ? U_PHP : U_CGI); + + U_RETURN(U_PLUGIN_HANDLER_OK); # endif } delete connection; connection = U_NULLPTR; + + U_RETURN(U_PLUGIN_HANDLER_ERROR); } U_RETURN(U_PLUGIN_HANDLER_OK); diff --git a/src/ulib/net/server/plugin/mod_ssi.cpp b/src/ulib/net/server/plugin/mod_ssi.cpp index 193139ad..de195594 100644 --- a/src/ulib/net/server/plugin/mod_ssi.cpp +++ b/src/ulib/net/server/plugin/mod_ssi.cpp @@ -1133,7 +1133,7 @@ int USSIPlugIn::handlerRequest() UClientImage_Base::environment->setEmpty(); } - // U_RETURN(U_PLUGIN_HANDLER_PROCESSED); + U_RETURN(U_PLUGIN_HANDLER_PROCESSED); } U_RETURN(U_PLUGIN_HANDLER_OK); diff --git a/src/ulib/net/server/server.cpp b/src/ulib/net/server/server.cpp index 7c92b59b..50de77d8 100644 --- a/src/ulib/net/server/server.cpp +++ b/src/ulib/net/server/server.cpp @@ -2157,9 +2157,6 @@ U_NO_EXPORT void UServer_Base::loadStaticLinkedModules(const char* name) if (vplugin_name->find(x) != U_NOT_FOUND) // NB: we load only the plugin that we want from configuration (PLUGIN var)... { -# ifndef U_LOG_DISABLE - bool ok = false; -# endif #if defined(U_STATIC_HANDLER_RPC) || defined(U_STATIC_HANDLER_SHIB) || defined(U_STATIC_HANDLER_ECHO) || \ defined(U_STATIC_HANDLER_STREAM) || defined(U_STATIC_HANDLER_SOCKET) || defined(U_STATIC_HANDLER_SCGI) || \ defined(U_STATIC_HANDLER_FCGI) || defined(U_STATIC_HANDLER_GEOIP) || defined(U_STATIC_HANDLER_PROXY) || \ @@ -2210,23 +2207,17 @@ U_NO_EXPORT void UServer_Base::loadStaticLinkedModules(const char* name) # endif next: if (_plugin) { -# ifndef U_LOG_DISABLE - ok = true; -# endif - vplugin_name_static->push_back(x); vplugin_static->push_back(_plugin); + + U_SRV_LOG("Link phase of static plugin %V success", x.rep); + } + else + { + U_SRV_LOG("WARNING: Link phase of static plugin %V failed", x.rep); } #endif - -# ifndef U_LOG_DISABLE - if (isLog()) - { - if (ok) log->log(U_CONSTANT_TO_PARAM( "Link phase of static plugin %V success"), x.rep); - else log->log(U_CONSTANT_TO_PARAM("WARNING: Link phase of static plugin %V failed"), x.rep); - } -# endif } } diff --git a/src/ulib/notifier.cpp b/src/ulib/notifier.cpp index b4f334ec..84172aed 100644 --- a/src/ulib/notifier.cpp +++ b/src/ulib/notifier.cpp @@ -962,9 +962,9 @@ bool UNotifier::modify(UEventFd* item) U_RETURN(true); } -void UNotifier::handlerDelete(int fd, int mask) +void UNotifier::handlerDelete(unsigned int fd, int mask) { - U_TRACE(0, "UNotifier::handlerDelete(%d,%B)", fd, mask) + U_TRACE(0, "UNotifier::handlerDelete(%u,%B)", fd, mask) U_INTERNAL_ASSERT_MAJOR(fd, 0) U_INTERNAL_ASSERT_DIFFERS(U_ClientImage_parallelization, U_PARALLELIZATION_CHILD) diff --git a/src/ulib/utility/uhttp.cpp b/src/ulib/utility/uhttp.cpp index 9445ba72..f6e3f7a2 100644 --- a/src/ulib/utility/uhttp.cpp +++ b/src/ulib/utility/uhttp.cpp @@ -4431,7 +4431,9 @@ file_in_cache: if (isValidation() == false) U_RETURN(U_PLUGIN_HANDLER_OK); # endif +# ifndef U_COVERITY_FALSE_POSITIVE // FORWARD_NULL mime_index = file_data->mime_index; +# endif U_INTERNAL_DUMP("mime_index(%d) = %C u_is_ssi() = %b", mime_index, mime_index, u_is_ssi(mime_index)) @@ -8826,8 +8828,12 @@ nocontent: UClientImage_Base::setCloseConnection(); if (U_STREQ(ptr, len, U_LIB_SUFFIX)) goto nocontent; + (void) suffix.assign(ptr, len); + + U_INTERNAL_DUMP("suffix = %V", suffix.rep) + if (U_HTTP_QUERY_STREQ("_nav_") && - U_STREQ(ptr, len, "usp")) + suffix.equal(U_CONSTANT_TO_PARAM("usp"))) { UClientImage_Base::setRequestNeedProcessing(); } @@ -8841,8 +8847,6 @@ nocontent: UClientImage_Base::setCloseConnection(); U_ASSERT_EQUALS(basename, UStringExt::basename(file->getPath())) - if (len) (void) suffix.assign(ptr, len); - (void) pathname->replace(U_FILE_TO_PARAM(*file)); manageDataForCache(basename, suffix);