From 5793ac74dbbd81bd94da1c7920dfe40ae391af03 Mon Sep 17 00:00:00 2001 From: Brian Bockelman Date: Wed, 24 Mar 2021 23:02:28 -0500 Subject: [PATCH] Remove use of smart pointers. Some versions of GCC apparently complain if C++ attributes are stripped by use in templates (even if said attributes are completely useless in the template context). Other than going through heroics to suppress the invalid warning, it seems the best approach is to revert to raw pointers. --- src/XrdTpc/XrdTpcNSSSupport.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/XrdTpc/XrdTpcNSSSupport.cc b/src/XrdTpc/XrdTpcNSSSupport.cc index ca81714e5ba..2c3a3879637 100644 --- a/src/XrdTpc/XrdTpcNSSSupport.cc +++ b/src/XrdTpc/XrdTpcNSSSupport.cc @@ -203,20 +203,21 @@ XrdTpcNSSSupport::Maintenance() return false; } - std::unique_ptr dirp(fdopendir(fddir), &closedir); + DIR *dirp = fdopendir(fddir); if (!dirp) { m_log.Emsg("XrdTpc", "Failed to allocate a directory pointer"); return false; } struct dirent *result; - while ((result = readdir(dirp.get()))) { + while ((result = readdir(dirp))) { //m_log.Emsg("Will parse file for CA certificates", result->d_name); if (result->d_type != DT_REG && result->d_type != DT_LNK) {continue;} if (result->d_name[0] == '.') {continue;} int fd = openat(fddir, result->d_name, O_RDONLY); if (fd < 0) { m_log.Emsg("XrdTpc", "Failed to open certificate file", result->d_name, strerror(errno)); + closedir(dirp); return false; } file_smart_ptr fp(fdopen(fd, "r"), &fclose); @@ -227,8 +228,10 @@ XrdTpcNSSSupport::Maintenance() } if (errno) { m_log.Emsg("XrdTpc", "Failure during readdir", strerror(errno)); + closedir(dirp); return false; } + closedir(dirp); m_next_update.store(time(NULL) + 900, std::memory_order_relaxed); m_ca_file.reset(new_file.release());