From 16fbb15ecc8cedfad6ce03e1891eed6fe28cedb0 Mon Sep 17 00:00:00 2001 From: Ulrich Wilkens Date: Thu, 31 May 2018 22:47:27 +0200 Subject: [PATCH] Fix BSD and Sun problems after coverity fixes --- cde/config/cf/sun.cf | 5 ++++- cde/lib/DtTerm/Term/TermParseTable.c | 1 - cde/lib/tt/lib/mp/mp_rpc_client.C | 6 +++++- cde/lib/tt/slib/mp_observer.C | 2 +- .../dtappbuilder/src/libABobjXm/objxm_config.c | 2 +- cde/programs/dtcalc/functions.c | 11 +++++++---- cde/programs/dtfile/dtcopy/fsrtns.c | 1 + cde/programs/dtinfo/DtMmdb/btree/mmdb_btree.C | 12 ++++++++---- cde/programs/dtinfo/DtMmdb/btree/mmdb_btree.h | 2 ++ cde/programs/dtinfo/dtinfo/src/Templates.C | 1 - cde/programs/dtlogin/session.c | 2 +- cde/programs/dtspcd/main.c | 2 +- 12 files changed, 31 insertions(+), 16 deletions(-) diff --git a/cde/config/cf/sun.cf b/cde/config/cf/sun.cf index 4c53beba..956da3ff 100644 --- a/cde/config/cf/sun.cf +++ b/cde/config/cf/sun.cf @@ -178,9 +178,12 @@ XCOMM Gnu C++ CplusplusCompilerMajorVersion./**/CplusplusCompilerMinorVersion #ifndef CplusplusLibC #define CplusplusLibC -L/opt/solarisstudio/lib -lCrun #endif +#ifndef OptimizedCplusplusDebugFlags +# define OptimizedCplusplusDebugFlags -O2 -erroff=attrskipunsup +#endif #ifndef CplusplusDependIncludes #if CplusplusCompilerMajorVersion > 3 -# define CplusplusDependIncludes -I/opt/solarisstudio/prod/include/CC -I/opt/solarisstudio/prod/include/CC/Cstd +# define CplusplusDependIncludes -I/opt/solarisstudio/prod/include/CC -I/opt/solarisstudio/prod/include/CC/Cstd -I/opt/solarisstudio/prod/include/CC/std #elif CplusplusCompilerMajorVersion > 2 # define CplusplusDependIncludes -I/opt/SUNWspro/SC3.0/include/CC #else diff --git a/cde/lib/DtTerm/Term/TermParseTable.c b/cde/lib/DtTerm/Term/TermParseTable.c index 46a8cfa0..6452626c 100644 --- a/cde/lib/DtTerm/Term/TermParseTable.c +++ b/cde/lib/DtTerm/Term/TermParseTable.c @@ -554,7 +554,6 @@ esc_P_table[] = { '0', '9', &_DtTermStateP, _DtTermEnterNum, /* enter number */ }, { '|', '|', &_DtTermStateUserKey, _DtTermParseUserKeyClear, /* DECUDK */ }, { '{', '{', &_DtTermStateDLCharSet, _DtTermPrimParserNextState, }, - { /* down-line-load char set */ }, { 0x00, 0xFF, &stateStart , _DtTermPrintState /* end of table */ }, }; StateTableRec _DtTermStateP = {False, esc_P_table, pre_parse_table}; diff --git a/cde/lib/tt/lib/mp/mp_rpc_client.C b/cde/lib/tt/lib/mp/mp_rpc_client.C index c393a488..6c2a8177 100644 --- a/cde/lib/tt/lib/mp/mp_rpc_client.C +++ b/cde/lib/tt/lib/mp/mp_rpc_client.C @@ -91,9 +91,13 @@ _Tt_rpc_client(int conn_socket) _program = 0; _version = 0; _server_uid = 0; - _clnt_stat = NULL; + _clnt_stat = RPC_SUCCESS; +#if defined(OPT_TLI) + _server_addr = 0; +#else _server_addr.sin_family = 0; _server_addr.sin_port = 0; +#endif } diff --git a/cde/lib/tt/slib/mp_observer.C b/cde/lib/tt/slib/mp_observer.C index bb1a2e22..49ab3049 100644 --- a/cde/lib/tt/slib/mp_observer.C +++ b/cde/lib/tt/slib/mp_observer.C @@ -49,7 +49,7 @@ _Tt_observer() _reliability = TT_DISCARD; _opnum = -1; - _scope = NULL; + _scope = TT_SCOPE_NONE; _state = TT_STATE_LAST; // BUG This class member is not set anywhere, but a getter function exists } diff --git a/cde/programs/dtappbuilder/src/libABobjXm/objxm_config.c b/cde/programs/dtappbuilder/src/libABobjXm/objxm_config.c index 119a9911..4dce682f 100644 --- a/cde/programs/dtappbuilder/src/libABobjXm/objxm_config.c +++ b/cde/programs/dtappbuilder/src/libABobjXm/objxm_config.c @@ -428,7 +428,7 @@ config_attachment( attachment = &(obj->attachments->south); break; default: - return; + return OK; } if (attachment->type == AB_ATTACH_OBJ) { diff --git a/cde/programs/dtcalc/functions.c b/cde/programs/dtcalc/functions.c index f3ba5f1a..f1d4bcf1 100644 --- a/cde/programs/dtcalc/functions.c +++ b/cde/programs/dtcalc/functions.c @@ -37,6 +37,9 @@ #include #include #include +#if defined(sun) +#include +#endif #include "calctool.h" extern char *base_str[] ; /* Strings for each base value. */ @@ -1729,13 +1732,13 @@ do_round(double result, int ndigits) int temp; if (isnan(result)) return result; -#if defined(_AIX) || defined(__aix) || defined(__sparc) +#if defined(_AIX) || defined(__aix) || defined(sun) temp = finite(result); if (!temp) return (temp > 0) ? HUGE : -HUGE; #else if ((temp = isinf(result))) return (temp > 0) ? HUGE : -HUGE; -#endif /* _AIX or sparc*/ +#endif /* _AIX or sun */ if (ndigits >= 0 && ndigits < MAX_DIGITS) { @@ -1843,13 +1846,13 @@ try_compute_i(double guess, double *result, int method) new_w = w - f / f_prime; -#if defined(_AIX) || defined(__aix) || defined(__sparc) +#if defined(_AIX) || defined(__aix) || defined(sun) if (!(!isnan(new_w) && finite(new_w))) return FALSE; #else if (!(!isnan(new_w) && !isinf(new_w))) return FALSE; -#endif /* _AIX or sparc */ +#endif /* _AIX or sun */ if (new_w == w || (w != 0.0 && fabs((new_w - w) / w) < FIN_EPSILON)) break; diff --git a/cde/programs/dtfile/dtcopy/fsrtns.c b/cde/programs/dtfile/dtcopy/fsrtns.c index 5e5243a4..fceb02c5 100644 --- a/cde/programs/dtfile/dtcopy/fsrtns.c +++ b/cde/programs/dtfile/dtcopy/fsrtns.c @@ -62,6 +62,7 @@ #include #include #include +#include #include "fsrtns.h" diff --git a/cde/programs/dtinfo/DtMmdb/btree/mmdb_btree.C b/cde/programs/dtinfo/DtMmdb/btree/mmdb_btree.C index b89215f3..e0c0e139 100644 --- a/cde/programs/dtinfo/DtMmdb/btree/mmdb_btree.C +++ b/cde/programs/dtinfo/DtMmdb/btree/mmdb_btree.C @@ -77,11 +77,15 @@ btree::btree(const char* store_name) btree::~btree() { - if ( btree_DB->sync(btree_DB, 0) == RET_ERROR ) - throw(stringException("btree sync failed")); + if ( btree_DB->sync(btree_DB, 0) == RET_ERROR ) { + cerr << "btree sync failed"; + std::exit(1); + } - if ( btree_DB->close(btree_DB) == RET_ERROR ) - throw(stringException("btree close failed")); + if ( btree_DB->close(btree_DB) == RET_ERROR ) { + cerr << "btree close failed"; + std::exit(1); + } } void btree::clean() diff --git a/cde/programs/dtinfo/DtMmdb/btree/mmdb_btree.h b/cde/programs/dtinfo/DtMmdb/btree/mmdb_btree.h index 2792bc2d..6cc5703a 100644 --- a/cde/programs/dtinfo/DtMmdb/btree/mmdb_btree.h +++ b/cde/programs/dtinfo/DtMmdb/btree/mmdb_btree.h @@ -68,6 +68,8 @@ #endif +#include + #include "dstr/index_agent.h" #include "btree_berkeley/db.h" diff --git a/cde/programs/dtinfo/dtinfo/src/Templates.C b/cde/programs/dtinfo/dtinfo/src/Templates.C index 6d104c72..e03f05c6 100644 --- a/cde/programs/dtinfo/dtinfo/src/Templates.C +++ b/cde/programs/dtinfo/dtinfo/src/Templates.C @@ -420,7 +420,6 @@ typedef Stack _stkNTPtr_; /* Basic subdir refs */ typedef CC_TPtrDlist _ccTPtrDLstCvSegmnt_; -#endif #endif #if defined(sun) | defined(hpux) diff --git a/cde/programs/dtlogin/session.c b/cde/programs/dtlogin/session.c index d0b73cfa..1226c810 100644 --- a/cde/programs/dtlogin/session.c +++ b/cde/programs/dtlogin/session.c @@ -1910,7 +1910,7 @@ RunGreeter( struct display *d, struct greet_info *greet, char *p; char **env; char *path; - struct greet_state state = {}; + struct greet_state state; int notify_dt; int dupfp = -1; int dupfp2 = -1; diff --git a/cde/programs/dtspcd/main.c b/cde/programs/dtspcd/main.c index 51808a86..b2ebf875 100644 --- a/cde/programs/dtspcd/main.c +++ b/cde/programs/dtspcd/main.c @@ -226,7 +226,7 @@ int main(int argc, XeString *argv) /* Open an error log with whatever name the library wants to use */ SPC_Open_Log(log_path, FALSE); SPC_Print_Protocol = spc_logF; - if(NULL == (stderr = freopen(log_path, "a", stderr))) { + if(NULL == freopen(log_path, "a", stderr)) { printf("Unable to reopen '%s' as stderr\n", log_path); exit(EXIT_FAILURE); } -- 2.25.1