mirror of
https://github.com/wfjm/w11.git
synced 2026-01-13 15:37:43 +00:00
coverity: catch exceptions in dtor
This commit is contained in:
parent
4b355707c8
commit
86380fc2c6
@ -66,6 +66,7 @@ The full set of tests is only run for tagged releases.
|
||||
- backend code review:
|
||||
- use for C++ compiles also `-Wpedantic`
|
||||
- fixes for uninitialized variables (coverity, all uncritical)
|
||||
- catch exceptions in dtors (coverity, use Catch2Cerr)
|
||||
- now -Wunused-parameter clean (comment out unused params)
|
||||
- now -Wunused-variable clean (comment out so far unused code)
|
||||
- move `using namespace std` after includes (clang warning)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: RlinkConnect.cpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RlinkConnect.cpp 1059 2018-10-27 10:34:16Z mueller $
|
||||
//
|
||||
// Copyright 2011-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2011-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-10-27 1059 2.6.3 coverity fixup (uncaught exception in dtor)
|
||||
// 2017-04-22 883 2.6.2 add rbus monitor probe, add HasRbmon()
|
||||
// 2017-04-07 868 2.6.1 Dump(): add detail arg
|
||||
// 2017-02-20 854 2.6 use Rtime, drop TimeOfDayAsDouble
|
||||
@ -163,7 +164,7 @@ RlinkConnect::RlinkConnect()
|
||||
|
||||
RlinkConnect::~RlinkConnect()
|
||||
{
|
||||
Close();
|
||||
Rtools::Catch2Cerr(__func__, [this](){ Close(); } );
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: RlinkPortCuff.cpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RlinkPortCuff.cpp 1059 2018-10-27 10:34:16Z mueller $
|
||||
//
|
||||
// Copyright 2012-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2012-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-10-27 1059 1.1.6 coverity fixup (uncaught exception in dtor)
|
||||
// 2017-04-15 875 1.1.5 Open(): set default scheme
|
||||
// 2017-03-04 858 1.1.4 use clock_gettime instead of gettimeofday
|
||||
// 2015-04-12 666 1.1.3 add noinit attribute
|
||||
@ -86,7 +87,8 @@ RlinkPortCuff::RlinkPortCuff()
|
||||
|
||||
RlinkPortCuff::~RlinkPortCuff()
|
||||
{
|
||||
if (IsOpen()) RlinkPortCuff::Close();
|
||||
if (IsOpen()) Rtools::Catch2Cerr(__func__,
|
||||
[this](){ RlinkPortCuff::Close(); } );
|
||||
}
|
||||
|
||||
//------------------------------------------+-----------------------------------
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: RlinkServer.cpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: RlinkServer.cpp 1059 2018-10-27 10:34:16Z mueller $
|
||||
//
|
||||
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-10-27 1059 1.2.3 coverity fixup (uncaught exception in dtor)
|
||||
// 2017-04-07 868 1.2.2 Dump(): add detail arg
|
||||
// 2015-06-05 686 1.2.1 BUGFIX: CallAttnHandler(): fix race in hnext
|
||||
// 2015-04-04 662 1.2 BUGFIX: fix race in Stop(), use UnStop()
|
||||
@ -40,6 +41,7 @@
|
||||
#include "librtools/RosPrintBvi.hpp"
|
||||
#include "librtools/Rexception.hpp"
|
||||
#include "librtools/RlogMsg.hpp"
|
||||
#include "librtools/Rtools.hpp"
|
||||
|
||||
#include "RlinkServer.hpp"
|
||||
|
||||
@ -107,7 +109,7 @@ RlinkServer::RlinkServer()
|
||||
|
||||
RlinkServer::~RlinkServer()
|
||||
{
|
||||
Stop();
|
||||
Rtools::Catch2Cerr(__func__, [this](){ Stop(); } );
|
||||
if (fspConn) fspConn->SetServer(0);
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: RtclAttnShuttle.cpp 1049 2018-09-22 13:56:52Z mueller $
|
||||
// $Id: RtclAttnShuttle.cpp 1059 2018-10-27 10:34:16Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-10-27 1059 1.1.1 coverity fixup (uncaught exception in dtor)
|
||||
// 2014-12-30 625 1.1 adopt to Rlink V4 attn logic
|
||||
// 2014-11-08 602 1.0.3 cast int first to ptrdiff_t, than to ClientData
|
||||
// 2014-08-22 584 1.0.2 use nullptr
|
||||
@ -31,6 +32,7 @@
|
||||
#include "boost/bind.hpp"
|
||||
|
||||
#include "librtools/Rexception.hpp"
|
||||
#include "librtools/Rtools.hpp"
|
||||
|
||||
#include "RtclAttnShuttle.hpp"
|
||||
|
||||
@ -69,7 +71,7 @@ RtclAttnShuttle::RtclAttnShuttle(uint16_t mask, Tcl_Obj* pobj)
|
||||
|
||||
RtclAttnShuttle::~RtclAttnShuttle()
|
||||
{
|
||||
Remove();
|
||||
Rtools::Catch2Cerr(__func__, [this](){ Remove();} );
|
||||
::close(fFdPipeWrite);
|
||||
::close(fFdPipeRead);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: Rw11VirtEthTap.cpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: Rw11VirtEthTap.cpp 1059 2018-10-27 10:34:16Z mueller $
|
||||
//
|
||||
// Copyright 2014-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2014-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,8 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-10-27 1059 1.0.1 coverity fixup (uncaught exception in dtor)
|
||||
// coverity fixup (buffer not null terminated)
|
||||
// 2017-04-15 875 1.0 Initial version
|
||||
// 2014-06-09 561 0.1 First draft
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -36,6 +38,7 @@
|
||||
#include "boost/bind.hpp"
|
||||
|
||||
#include "librtools/RosFill.hpp"
|
||||
#include "librtools/Rtools.hpp"
|
||||
|
||||
#include "Rw11VirtEthTap.hpp"
|
||||
|
||||
@ -63,8 +66,9 @@ Rw11VirtEthTap::Rw11VirtEthTap(Rw11Unit* punit)
|
||||
Rw11VirtEthTap::~Rw11VirtEthTap()
|
||||
{
|
||||
if (fFd>=2) {
|
||||
Server().RemovePollHandler(fFd);
|
||||
close(fFd);
|
||||
Rtools::Catch2Cerr(__func__,
|
||||
[this](){ Server().RemovePollHandler(fFd); } );
|
||||
::close(fFd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +94,7 @@ bool Rw11VirtEthTap::Open(const std::string& url, RerrMsg& emsg)
|
||||
|
||||
struct ifreq ifr;
|
||||
::memset(&ifr, 0, sizeof(ifr));
|
||||
strncpy(ifr.ifr_name, fUrl.Path().c_str(), IFNAMSIZ);
|
||||
::strncpy(ifr.ifr_name, fUrl.Path().c_str(), IFNAMSIZ-1);
|
||||
ifr.ifr_flags = IFF_TAP|IFF_NO_PI;
|
||||
|
||||
if (::ioctl(fd, TUNSETIFF, &ifr) < 0) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// $Id: Rw11VirtTermPty.cpp 983 2018-01-02 20:35:59Z mueller $
|
||||
// $Id: Rw11VirtTermPty.cpp 1059 2018-10-27 10:34:16Z mueller $
|
||||
//
|
||||
// Copyright 2013-2017 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
// This program is free software; you may redistribute and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-10-27 1059 1.0.3 coverity fixup (uncaught exception in dtor)
|
||||
// 2017-04-15 875 1.0.2 Open(): set default scheme
|
||||
// 2017-04-07 868 1.0.1 Dump(): add detail arg
|
||||
// 2013-03-06 495 1.0 Initial version
|
||||
@ -59,8 +60,9 @@ Rw11VirtTermPty::Rw11VirtTermPty(Rw11Unit* punit)
|
||||
Rw11VirtTermPty::~Rw11VirtTermPty()
|
||||
{
|
||||
if (fFd>=2) {
|
||||
Server().RemovePollHandler(fFd);
|
||||
close(fFd);
|
||||
Rtools::Catch2Cerr(__func__,
|
||||
[this](){ Server().RemovePollHandler(fFd); } );
|
||||
::close(fFd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// $Id: Rw11VirtTermTcp.cpp 1049 2018-09-22 13:56:52Z mueller $
|
||||
// $Id: Rw11VirtTermTcp.cpp 1059 2018-10-27 10:34:16Z mueller $
|
||||
//
|
||||
// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
||||
//
|
||||
@ -13,6 +13,7 @@
|
||||
//
|
||||
// Revision History:
|
||||
// Date Rev Version Comment
|
||||
// 2018-10-27 1059 1.0.7 coverity fixup (uncaught exception in dtor)
|
||||
// 2017-04-15 875 1.0.6 Open(): set default scheme
|
||||
// 2017-04-07 868 1.0.5 Dump(): add detail arg
|
||||
// 2014-08-22 584 1.0.4 use nullptr
|
||||
@ -37,6 +38,7 @@
|
||||
|
||||
#include "librtools/RosFill.hpp"
|
||||
#include "librtools/RlogMsg.hpp"
|
||||
#include "librtools/Rtools.hpp"
|
||||
|
||||
#include "Rw11VirtTermTcp.hpp"
|
||||
|
||||
@ -104,12 +106,14 @@ Rw11VirtTermTcp::Rw11VirtTermTcp(Rw11Unit* punit)
|
||||
Rw11VirtTermTcp::~Rw11VirtTermTcp()
|
||||
{
|
||||
if (fFdListen > 2) {
|
||||
Server().RemovePollHandler(fFdListen);
|
||||
close(fFdListen);
|
||||
Rtools::Catch2Cerr(__func__,
|
||||
[this](){ Server().RemovePollHandler(fFdListen); } );
|
||||
::close(fFdListen);
|
||||
}
|
||||
if (Connected()) {
|
||||
Server().RemovePollHandler(fFd);
|
||||
close(fFd);
|
||||
Rtools::Catch2Cerr(__func__,
|
||||
[this](){ Server().RemovePollHandler(fFd); } );
|
||||
::close(fFd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user