From b9f639777cd44823219f8c1df046cccbb338c3cd Mon Sep 17 00:00:00 2001 From: Michal Simon Date: Wed, 20 Jan 2021 21:15:38 +0100 Subject: [PATCH] [XrdEc] Don't close ZipArchive obj that were not opened. --- src/XrdEc/XrdEcReader.cc | 6 +++--- src/XrdEc/XrdEcStrmWriter.cc | 32 +++++++++++++++++++++++++------- src/XrdEc/XrdEcStrmWriter.hh | 29 +++++++++++++++++++++++------ 3 files changed, 51 insertions(+), 16 deletions(-) diff --git a/src/XrdEc/XrdEcReader.cc b/src/XrdEc/XrdEcReader.cc index 4ac02b78db6..7debcbedad0 100644 --- a/src/XrdEc/XrdEcReader.cc +++ b/src/XrdEc/XrdEcReader.cc @@ -531,9 +531,9 @@ namespace XrdEc auto itr = dataarchs.begin(); for( ; itr != dataarchs.end() ; ++itr ) { - XrdCl::ZipArchive &zip = *itr->second; - if( zip.IsOpen() ) - closes.emplace_back( XrdCl::CloseArchive( zip ) ); + auto &zipptr = itr->second; + if( zipptr->IsOpen() ) + closes.emplace_back( XrdCl::CloseArchive( *zipptr ) >> [zipptr]( XrdCl::XRootDStatus& ){ } ); } // if there is nothing to close just schedule the handler diff --git a/src/XrdEc/XrdEcStrmWriter.cc b/src/XrdEc/XrdEcStrmWriter.cc index 611861bd5ff..994888dfc1f 100644 --- a/src/XrdEc/XrdEcStrmWriter.cc +++ b/src/XrdEc/XrdEcStrmWriter.cc @@ -1,9 +1,26 @@ -/* - * XrdEcStrmWriter.cc - * - * Created on: 5 May 2020 - * Author: simonm - */ +//------------------------------------------------------------------------------ +// Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN) +// Author: Michal Simon +//------------------------------------------------------------------------------ +// This file is part of the XRootD software suite. +// +// XRootD is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// XRootD is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with XRootD. If not, see . +// +// In applying this licence, CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +//------------------------------------------------------------------------------ #include "XrdEc/XrdEcStrmWriter.hh" #include "XrdEc/XrdEcThreadPool.hh" @@ -275,7 +292,8 @@ namespace XrdEc //----------------------------------------------------------------------- // close ZIP archives with data //----------------------------------------------------------------------- - closes.emplace_back( XrdCl::CloseArchive( *dataarchs[i] ) ); + if( dataarchs[i]->IsOpen() ) + closes.emplace_back( XrdCl::CloseArchive( *dataarchs[i] ) ); //----------------------------------------------------------------------- // replicate the metadata //----------------------------------------------------------------------- diff --git a/src/XrdEc/XrdEcStrmWriter.hh b/src/XrdEc/XrdEcStrmWriter.hh index a4009e003c8..aa0006b79f7 100644 --- a/src/XrdEc/XrdEcStrmWriter.hh +++ b/src/XrdEc/XrdEcStrmWriter.hh @@ -1,9 +1,26 @@ -/* - * XrdEcStrmWriter.hh - * - * Created on: 5 May 2020 - * Author: simonm - */ +//------------------------------------------------------------------------------ +// Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN) +// Author: Michal Simon +//------------------------------------------------------------------------------ +// This file is part of the XRootD software suite. +// +// XRootD is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// XRootD is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with XRootD. If not, see . +// +// In applying this licence, CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +//------------------------------------------------------------------------------ #ifndef SRC_XRDEC_XRDECSTRMWRITER_HH_ #define SRC_XRDEC_XRDECSTRMWRITER_HH_