From 8d7017273f021a1164af8403e8c6329a83d1a4af Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Mon, 21 Aug 2023 23:30:08 -0500 Subject: [PATCH] Misc fixes for older platforms --- src/fs_mktemp.cpp | 7 ++++--- src/gidcache.cpp | 13 ++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fs_mktemp.cpp b/src/fs_mktemp.cpp index 39e45ebe..34c2bf5e 100644 --- a/src/fs_mktemp.cpp +++ b/src/fs_mktemp.cpp @@ -25,6 +25,7 @@ #include #include +#include #define PAD_LEN 16 #define MAX_ATTEMPTS 3 @@ -75,12 +76,12 @@ namespace fs if((fd == -1) && (errno == EEXIST)) continue; if(fd == -1) - return {-errno,std::string{}}; + return std::make_tuple(-errno,std::string()); - return {fd,tmp_filepath}; + return std::make_tuple(fd,tmp_filepath); } - return {-EEXIST,std::string{}}; + return std::make_tuple(-EEXIST,std::string()); } std::tuple diff --git a/src/gidcache.cpp b/src/gidcache.cpp index dbd61f06..cdf71b4e 100644 --- a/src/gidcache.cpp +++ b/src/gidcache.cpp @@ -34,11 +34,10 @@ #include #include - #include "gidcache.hpp" -std::mutex g_REGISTERED_CACHES_MUTEX; -std::unordered_map g_REGISTERED_CACHES; +std::mutex g_REGISTERED_CACHES_MUTEX; +std::unordered_map g_REGISTERED_CACHES; inline @@ -55,11 +54,11 @@ GIDCache::GIDCache() { std::lock_guard guard(g_REGISTERED_CACHES_MUTEX); - pid_t tid; - bool inserted; + bool inserted; + pthread_t pthid; - tid = ::gettid(); - inserted = g_REGISTERED_CACHES.emplace(tid,this).second; + pthid = pthread_self(); + inserted = g_REGISTERED_CACHES.emplace(pthid,this).second; assert(inserted == true); }