Browse Source
Merge pull request #1234 from trapexit/fixes
Misc fixes for older platforms
pull/1237/head
trapexit
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
10 additions and
10 deletions
-
src/fs_mktemp.cpp
-
src/gidcache.cpp
|
|
@ -25,6 +25,7 @@ |
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <string>
|
|
|
|
#include <tuple>
|
|
|
|
|
|
|
|
#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<int,std::string> |
|
|
|
|
|
@ -34,11 +34,10 @@ |
|
|
|
#include <unordered_map>
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
|
|
|
|
#include "gidcache.hpp"
|
|
|
|
|
|
|
|
std::mutex g_REGISTERED_CACHES_MUTEX; |
|
|
|
std::unordered_map<pid_t,GIDCache*> g_REGISTERED_CACHES; |
|
|
|
std::unordered_map<pthread_t,GIDCache*> g_REGISTERED_CACHES; |
|
|
|
|
|
|
|
|
|
|
|
inline |
|
|
@ -55,11 +54,11 @@ GIDCache::GIDCache() |
|
|
|
{ |
|
|
|
std::lock_guard<std::mutex> guard(g_REGISTERED_CACHES_MUTEX); |
|
|
|
|
|
|
|
pid_t tid; |
|
|
|
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); |
|
|
|
} |
|
|
|