mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-04-03 02:09:03 +08:00
stop clonepath at base directory. fixes #467
This commit is contained in:
parent
62ae871d51
commit
f48c16d162
@ -34,7 +34,6 @@ using std::vector;
|
|||||||
using namespace mergerfs;
|
using namespace mergerfs;
|
||||||
|
|
||||||
static
|
static
|
||||||
inline
|
|
||||||
int
|
int
|
||||||
_create_core(const string &fullpath,
|
_create_core(const string &fullpath,
|
||||||
mode_t mode,
|
mode_t mode,
|
||||||
@ -49,10 +48,8 @@ _create_core(const string &fullpath,
|
|||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
_create_core(const string &existingpath,
|
_create_core(const string &createpath,
|
||||||
const string &createpath,
|
|
||||||
const char *fusepath,
|
const char *fusepath,
|
||||||
const char *fusedirpath,
|
|
||||||
const mode_t mode,
|
const mode_t mode,
|
||||||
const mode_t umask,
|
const mode_t umask,
|
||||||
const int flags,
|
const int flags,
|
||||||
@ -61,14 +58,6 @@ _create_core(const string &existingpath,
|
|||||||
int rv;
|
int rv;
|
||||||
string fullpath;
|
string fullpath;
|
||||||
|
|
||||||
if(createpath != existingpath)
|
|
||||||
{
|
|
||||||
const ugid::SetRootGuard ugidGuard;
|
|
||||||
rv = fs::clonepath(existingpath,createpath,fusedirpath);
|
|
||||||
if(rv == -1)
|
|
||||||
return -errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs::path::make(&createpath,fusepath,fullpath);
|
fs::path::make(&createpath,fusepath,fullpath);
|
||||||
|
|
||||||
rv = _create_core(fullpath,mode,umask,flags);
|
rv = _create_core(fullpath,mode,umask,flags);
|
||||||
@ -111,8 +100,12 @@ _create(Policy::Func::Search searchFunc,
|
|||||||
if(rv == -1)
|
if(rv == -1)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
return _create_core(*existingpaths[0],*createpaths[0],
|
rv = fs::clonepath_as_root(*existingpaths[0],*createpaths[0],fusedirpath);
|
||||||
fusepath,fusedirpathcstr,
|
if(rv == -1)
|
||||||
|
return -errno;
|
||||||
|
|
||||||
|
return _create_core(*createpaths[0],
|
||||||
|
fusepath,
|
||||||
mode,umask,flags,fh);
|
mode,umask,flags,fh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "fs_clonepath.hpp"
|
#include "fs_clonepath.hpp"
|
||||||
#include "fs_path.hpp"
|
#include "fs_path.hpp"
|
||||||
#include "fs_xattr.hpp"
|
#include "fs_xattr.hpp"
|
||||||
|
#include "ugid.hpp"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
@ -59,6 +60,9 @@ namespace fs
|
|||||||
string frompath;
|
string frompath;
|
||||||
string dirname;
|
string dirname;
|
||||||
|
|
||||||
|
if((relative == NULL) || (relative[0] == '\0'))
|
||||||
|
return 0;
|
||||||
|
|
||||||
dirname = relative;
|
dirname = relative;
|
||||||
fs::path::dirname(dirname);
|
fs::path::dirname(dirname);
|
||||||
if(!dirname.empty())
|
if(!dirname.empty())
|
||||||
@ -114,4 +118,29 @@ namespace fs
|
|||||||
{
|
{
|
||||||
return fs::clonepath(from,to,relative.c_str());
|
return fs::clonepath(from,to,relative.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
clonepath_as_root(const string &from,
|
||||||
|
const string &to,
|
||||||
|
const char *relative)
|
||||||
|
{
|
||||||
|
if((relative == NULL) || (relative[0] == '\0'))
|
||||||
|
return 0;
|
||||||
|
if(from == to)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
const ugid::SetRootGuard ugidGuard;
|
||||||
|
|
||||||
|
return fs::clonepath(from,to,relative);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
clonepath_as_root(const std::string &from,
|
||||||
|
const std::string &to,
|
||||||
|
const std::string &relative)
|
||||||
|
{
|
||||||
|
return fs::clonepath_as_root(from,to,relative.c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,4 +26,11 @@ namespace fs
|
|||||||
int clonepath(const std::string &from,
|
int clonepath(const std::string &from,
|
||||||
const std::string &to,
|
const std::string &to,
|
||||||
const std::string &relative);
|
const std::string &relative);
|
||||||
|
|
||||||
|
int clonepath_as_root(const std::string &from,
|
||||||
|
const std::string &to,
|
||||||
|
const char *relative);
|
||||||
|
int clonepath_as_root(const std::string &from,
|
||||||
|
const std::string &to,
|
||||||
|
const std::string &relative);
|
||||||
}
|
}
|
||||||
|
18
src/link.cpp
18
src/link.cpp
@ -39,21 +39,12 @@ _link_create_path_core(const string &oldbasepath,
|
|||||||
const string &newbasepath,
|
const string &newbasepath,
|
||||||
const char *oldfusepath,
|
const char *oldfusepath,
|
||||||
const char *newfusepath,
|
const char *newfusepath,
|
||||||
const string &newfusedirpath,
|
|
||||||
const int error)
|
const int error)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
string oldfullpath;
|
string oldfullpath;
|
||||||
string newfullpath;
|
string newfullpath;
|
||||||
|
|
||||||
if(oldbasepath != newbasepath)
|
|
||||||
{
|
|
||||||
const ugid::SetRootGuard ugidGuard;
|
|
||||||
rv = fs::clonepath(newbasepath,oldbasepath,newfusedirpath);
|
|
||||||
if(rv == -1)
|
|
||||||
return errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs::path::make(&oldbasepath,oldfusepath,oldfullpath);
|
fs::path::make(&oldbasepath,oldfusepath,oldfullpath);
|
||||||
fs::path::make(&oldbasepath,newfusepath,newfullpath);
|
fs::path::make(&oldbasepath,newfusepath,newfullpath);
|
||||||
|
|
||||||
@ -70,14 +61,18 @@ _link_create_path_loop(const vector<const string*> &oldbasepaths,
|
|||||||
const char *newfusepath,
|
const char *newfusepath,
|
||||||
const string &newfusedirpath)
|
const string &newfusedirpath)
|
||||||
{
|
{
|
||||||
|
int rv;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = -1;
|
error = -1;
|
||||||
for(size_t i = 0, ei = oldbasepaths.size(); i != ei; i++)
|
for(size_t i = 0, ei = oldbasepaths.size(); i != ei; i++)
|
||||||
{
|
{
|
||||||
|
rv = fs::clonepath_as_root(newbasepath,*oldbasepaths[i],newfusedirpath);
|
||||||
|
if(rv == -1)
|
||||||
|
error = error::calc(rv,error,errno);
|
||||||
|
else
|
||||||
error = _link_create_path_core(*oldbasepaths[i],newbasepath,
|
error = _link_create_path_core(*oldbasepaths[i],newbasepath,
|
||||||
oldfusepath,newfusepath,
|
oldfusepath,newfusepath,
|
||||||
newfusedirpath,
|
|
||||||
error);
|
error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,8 +138,7 @@ _clonepath_if_would_create(Policy::Func::Search searchFunc,
|
|||||||
if(rv == -1)
|
if(rv == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
const ugid::SetRootGuard ugidGuard;
|
return fs::clonepath_as_root(*newbasepath[0],oldbasepath,newfusedirpathcstr);
|
||||||
return fs::clonepath(*newbasepath[0],oldbasepath,newfusedirpathcstr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -34,7 +34,6 @@ using std::vector;
|
|||||||
using namespace mergerfs;
|
using namespace mergerfs;
|
||||||
|
|
||||||
static
|
static
|
||||||
inline
|
|
||||||
int
|
int
|
||||||
_mkdir_core(const string &fullpath,
|
_mkdir_core(const string &fullpath,
|
||||||
mode_t mode,
|
mode_t mode,
|
||||||
@ -48,10 +47,8 @@ _mkdir_core(const string &fullpath,
|
|||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
_mkdir_loop_core(const string &existingpath,
|
_mkdir_loop_core(const string &createpath,
|
||||||
const string &createpath,
|
|
||||||
const char *fusepath,
|
const char *fusepath,
|
||||||
const char *fusedirpath,
|
|
||||||
const mode_t mode,
|
const mode_t mode,
|
||||||
const mode_t umask,
|
const mode_t umask,
|
||||||
const int error)
|
const int error)
|
||||||
@ -59,14 +56,6 @@ _mkdir_loop_core(const string &existingpath,
|
|||||||
int rv;
|
int rv;
|
||||||
string fullpath;
|
string fullpath;
|
||||||
|
|
||||||
if(createpath != existingpath)
|
|
||||||
{
|
|
||||||
const ugid::SetRootGuard ugidGuard;
|
|
||||||
rv = fs::clonepath(existingpath,createpath,fusedirpath);
|
|
||||||
if(rv == -1)
|
|
||||||
return errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs::path::make(&createpath,fusepath,fullpath);
|
fs::path::make(&createpath,fusepath,fullpath);
|
||||||
|
|
||||||
rv = _mkdir_core(fullpath,mode,umask);
|
rv = _mkdir_core(fullpath,mode,umask);
|
||||||
@ -83,13 +72,19 @@ _mkdir_loop(const string &existingpath,
|
|||||||
const mode_t mode,
|
const mode_t mode,
|
||||||
const mode_t umask)
|
const mode_t umask)
|
||||||
{
|
{
|
||||||
|
int rv;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = -1;
|
error = -1;
|
||||||
for(size_t i = 0, ei = createpaths.size(); i != ei; i++)
|
for(size_t i = 0, ei = createpaths.size(); i != ei; i++)
|
||||||
{
|
{
|
||||||
error = _mkdir_loop_core(existingpath,*createpaths[i],
|
rv = fs::clonepath_as_root(existingpath,*createpaths[i],fusedirpath);
|
||||||
fusepath,fusedirpath,mode,umask,error);
|
if(rv == -1)
|
||||||
|
error = error::calc(rv,error,errno);
|
||||||
|
else
|
||||||
|
error = _mkdir_loop_core(*createpaths[i],
|
||||||
|
fusepath,
|
||||||
|
mode,umask,error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -error;
|
return -error;
|
||||||
|
@ -49,10 +49,8 @@ _mknod_core(const string &fullpath,
|
|||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
_mknod_loop_core(const string &existingpath,
|
_mknod_loop_core(const string &createpath,
|
||||||
const string &createpath,
|
|
||||||
const char *fusepath,
|
const char *fusepath,
|
||||||
const char *fusedirpath,
|
|
||||||
const mode_t mode,
|
const mode_t mode,
|
||||||
const mode_t umask,
|
const mode_t umask,
|
||||||
const dev_t dev,
|
const dev_t dev,
|
||||||
@ -61,14 +59,6 @@ _mknod_loop_core(const string &existingpath,
|
|||||||
int rv;
|
int rv;
|
||||||
string fullpath;
|
string fullpath;
|
||||||
|
|
||||||
if(createpath != existingpath)
|
|
||||||
{
|
|
||||||
const ugid::SetRootGuard ugidGuard;
|
|
||||||
rv = fs::clonepath(existingpath,createpath,fusedirpath);
|
|
||||||
if(rv == -1)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs::path::make(&createpath,fusepath,fullpath);
|
fs::path::make(&createpath,fusepath,fullpath);
|
||||||
|
|
||||||
rv = _mknod_core(fullpath,mode,umask,dev);
|
rv = _mknod_core(fullpath,mode,umask,dev);
|
||||||
@ -86,13 +76,18 @@ _mknod_loop(const string &existingpath,
|
|||||||
const mode_t umask,
|
const mode_t umask,
|
||||||
const dev_t dev)
|
const dev_t dev)
|
||||||
{
|
{
|
||||||
|
int rv;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = -1;
|
error = -1;
|
||||||
for(size_t i = 0, ei = createpaths.size(); i != ei; i++)
|
for(size_t i = 0, ei = createpaths.size(); i != ei; i++)
|
||||||
{
|
{
|
||||||
error = _mknod_loop_core(existingpath,*createpaths[i],
|
rv = fs::clonepath_as_root(existingpath,*createpaths[i],fusedirpath);
|
||||||
fusepath,fusedirpath,
|
if(rv == -1)
|
||||||
|
error = error::calc(rv,error,errno);
|
||||||
|
else
|
||||||
|
error = _mknod_loop_core(*createpaths[i],
|
||||||
|
fusepath,
|
||||||
mode,umask,dev,error);
|
mode,umask,dev,error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "fs_path.hpp"
|
#include "fs_path.hpp"
|
||||||
#include "rv.hpp"
|
#include "rv.hpp"
|
||||||
#include "rwlock.hpp"
|
#include "rwlock.hpp"
|
||||||
#include "success_fail.hpp"
|
|
||||||
#include "ugid.hpp"
|
#include "ugid.hpp"
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
@ -57,27 +56,6 @@ _remove(const vector<string> &toremove)
|
|||||||
fs::remove(toremove[i]);
|
fs::remove(toremove[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
|
||||||
int
|
|
||||||
_rename(const std::string &oldbasepath,
|
|
||||||
const std::string &oldfullpath,
|
|
||||||
const std::string &newbasepath,
|
|
||||||
const std::string &newfusedirpath,
|
|
||||||
const std::string &newfullpath)
|
|
||||||
{
|
|
||||||
int rv;
|
|
||||||
|
|
||||||
if(oldbasepath != newbasepath)
|
|
||||||
{
|
|
||||||
const ugid::SetRootGuard guard;
|
|
||||||
rv = fs::clonepath(newbasepath,oldbasepath,newfusedirpath);
|
|
||||||
if(rv == -1)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fs::rename(oldfullpath,newfullpath);
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
_rename_create_path_core(const vector<const string*> &oldbasepaths,
|
_rename_create_path_core(const vector<const string*> &oldbasepaths,
|
||||||
@ -94,21 +72,26 @@ _rename_create_path_core(const vector<const string*> &oldbasepaths,
|
|||||||
string oldfullpath;
|
string oldfullpath;
|
||||||
string newfullpath;
|
string newfullpath;
|
||||||
|
|
||||||
fs::path::make(&oldbasepath,newfusepath,newfullpath);
|
|
||||||
|
|
||||||
ismember = member(oldbasepaths,oldbasepath);
|
ismember = member(oldbasepaths,oldbasepath);
|
||||||
if(ismember)
|
if(ismember)
|
||||||
|
{
|
||||||
|
rv = fs::clonepath_as_root(newbasepath,oldbasepath,newfusedirpath);
|
||||||
|
if(rv != -1)
|
||||||
{
|
{
|
||||||
fs::path::make(&oldbasepath,oldfusepath,oldfullpath);
|
fs::path::make(&oldbasepath,oldfusepath,oldfullpath);
|
||||||
|
fs::path::make(&oldbasepath,newfusepath,newfullpath);
|
||||||
|
|
||||||
|
rv = fs::rename(oldfullpath,newfullpath);
|
||||||
|
}
|
||||||
|
|
||||||
rv = _rename(oldbasepath,oldfullpath,
|
|
||||||
newbasepath,newfusedirpath,newfullpath);
|
|
||||||
error = error::calc(rv,error,errno);
|
error = error::calc(rv,error,errno);
|
||||||
if(RENAME_FAILED(rv))
|
if(rv == -1)
|
||||||
tounlink.push_back(oldfullpath);
|
tounlink.push_back(oldfullpath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
fs::path::make(&oldbasepath,newfusepath,newfullpath);
|
||||||
|
|
||||||
tounlink.push_back(newfullpath);
|
tounlink.push_back(newfullpath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,7 +121,7 @@ _rename_create_path(Policy::Func::Search searchFunc,
|
|||||||
if(POLICY_FAILED(rv))
|
if(POLICY_FAILED(rv))
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
error = RENAME_FAIL;
|
error = -1;
|
||||||
for(size_t i = 0, ei = srcmounts.size(); i != ei; i++)
|
for(size_t i = 0, ei = srcmounts.size(); i != ei; i++)
|
||||||
{
|
{
|
||||||
const string &oldbasepath = srcmounts[i];
|
const string &oldbasepath = srcmounts[i];
|
||||||
@ -150,7 +133,8 @@ _rename_create_path(Policy::Func::Search searchFunc,
|
|||||||
error,toremove);
|
error,toremove);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RENAME_SUCCEEDED(error))
|
|
||||||
|
if(error == 0)
|
||||||
_remove(toremove);
|
_remove(toremove);
|
||||||
|
|
||||||
return -error;
|
return -error;
|
||||||
@ -169,12 +153,9 @@ _clonepath(Policy::Func::Search searchFunc,
|
|||||||
|
|
||||||
rv = searchFunc(srcmounts,fusedirpath.c_str(),minfreespace,srcbasepath);
|
rv = searchFunc(srcmounts,fusedirpath.c_str(),minfreespace,srcbasepath);
|
||||||
if(POLICY_FAILED(rv))
|
if(POLICY_FAILED(rv))
|
||||||
return rv;
|
return -errno;
|
||||||
|
|
||||||
{
|
fs::clonepath_as_root(*srcbasepath[0],dstbasepath,fusedirpath);
|
||||||
const ugid::SetRootGuard ugidGuard;
|
|
||||||
fs::clonepath(*srcbasepath[0],dstbasepath,fusedirpath);
|
|
||||||
}
|
|
||||||
|
|
||||||
return POLICY_SUCCESS;
|
return POLICY_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -232,7 +213,7 @@ _rename_preserve_path_core(Policy::Func::Search searchFunc,
|
|||||||
fs::path::make(&oldbasepath,oldfusepath,oldfullpath);
|
fs::path::make(&oldbasepath,oldfusepath,oldfullpath);
|
||||||
|
|
||||||
rv = fs::rename(oldfullpath,newfullpath);
|
rv = fs::rename(oldfullpath,newfullpath);
|
||||||
if(RENAME_FAILED_WITH(rv,ENOENT))
|
if((rv == -1) && (errno == ENOENT))
|
||||||
{
|
{
|
||||||
rv = _clonepath_if_would_create(searchFunc,createFunc,
|
rv = _clonepath_if_would_create(searchFunc,createFunc,
|
||||||
srcmounts,minfreespace,
|
srcmounts,minfreespace,
|
||||||
@ -242,7 +223,7 @@ _rename_preserve_path_core(Policy::Func::Search searchFunc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
error = error::calc(rv,error,errno);
|
error = error::calc(rv,error,errno);
|
||||||
if(RENAME_FAILED(rv))
|
if(rv == -1)
|
||||||
toremove.push_back(oldfullpath);
|
toremove.push_back(oldfullpath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -270,7 +251,7 @@ _rename_preserve_path(Policy::Func::Search searchFunc,
|
|||||||
if(POLICY_FAILED(rv))
|
if(POLICY_FAILED(rv))
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
error = RENAME_FAIL;
|
error = -1;
|
||||||
for(size_t i = 0, ei = srcmounts.size(); i != ei; i++)
|
for(size_t i = 0, ei = srcmounts.size(); i != ei; i++)
|
||||||
{
|
{
|
||||||
const string &oldbasepath = srcmounts[i];
|
const string &oldbasepath = srcmounts[i];
|
||||||
@ -282,7 +263,7 @@ _rename_preserve_path(Policy::Func::Search searchFunc,
|
|||||||
error,toremove);
|
error,toremove);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RENAME_SUCCEEDED(error))
|
if(error == 0)
|
||||||
_remove(toremove);
|
_remove(toremove);
|
||||||
|
|
||||||
return -error;
|
return -error;
|
||||||
|
@ -36,24 +36,14 @@ using namespace mergerfs;
|
|||||||
|
|
||||||
static
|
static
|
||||||
int
|
int
|
||||||
_symlink_loop_core(const string &existingpath,
|
_symlink_loop_core(const string &newbasepath,
|
||||||
const string &newbasepath,
|
|
||||||
const char *oldpath,
|
const char *oldpath,
|
||||||
const char *newpath,
|
const char *newpath,
|
||||||
const char *newdirpath,
|
|
||||||
const int error)
|
const int error)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
string fullnewpath;
|
string fullnewpath;
|
||||||
|
|
||||||
if(newbasepath != existingpath)
|
|
||||||
{
|
|
||||||
const ugid::SetRootGuard ugidGuard;
|
|
||||||
rv = fs::clonepath(existingpath,newbasepath,newdirpath);
|
|
||||||
if(rv == -1)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs::path::make(&newbasepath,newpath,fullnewpath);
|
fs::path::make(&newbasepath,newpath,fullnewpath);
|
||||||
|
|
||||||
rv = fs::symlink(oldpath,fullnewpath);
|
rv = fs::symlink(oldpath,fullnewpath);
|
||||||
@ -69,13 +59,19 @@ _symlink_loop(const string &existingpath,
|
|||||||
const char *newpath,
|
const char *newpath,
|
||||||
const char *newdirpath)
|
const char *newdirpath)
|
||||||
{
|
{
|
||||||
|
int rv;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
error = -1;
|
error = -1;
|
||||||
for(size_t i = 0, ei = newbasepaths.size(); i != ei; i++)
|
for(size_t i = 0, ei = newbasepaths.size(); i != ei; i++)
|
||||||
{
|
{
|
||||||
error = _symlink_loop_core(existingpath,*newbasepaths[i],
|
rv = fs::clonepath_as_root(existingpath,*newbasepaths[i],newdirpath);
|
||||||
oldpath,newpath,newdirpath,
|
if(rv == -1)
|
||||||
|
error = error::calc(rv,error,errno);
|
||||||
|
else
|
||||||
|
error = _symlink_loop_core(*newbasepaths[i],
|
||||||
|
oldpath,
|
||||||
|
newpath,
|
||||||
error);
|
error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,10 +22,8 @@
|
|||||||
#include "ugid_rwlock.icpp"
|
#include "ugid_rwlock.icpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace mergerfs
|
namespace ugid
|
||||||
{
|
{
|
||||||
namespace ugid
|
|
||||||
{
|
|
||||||
void
|
void
|
||||||
initgroups(const uid_t uid,
|
initgroups(const uid_t uid,
|
||||||
const gid_t gid)
|
const gid_t gid)
|
||||||
@ -34,5 +32,4 @@ namespace mergerfs
|
|||||||
|
|
||||||
cache.initgroups(uid,gid);
|
cache.initgroups(uid,gid);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,13 +21,10 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace mergerfs
|
namespace ugid
|
||||||
{
|
{
|
||||||
namespace ugid
|
|
||||||
{
|
|
||||||
void init();
|
void init();
|
||||||
void initgroups(const uid_t uid, const gid_t gid);
|
void initgroups(const uid_t uid, const gid_t gid);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined __linux__ and UGID_USE_RWLOCK == 0
|
#if defined __linux__ and UGID_USE_RWLOCK == 0
|
||||||
|
@ -51,11 +51,8 @@
|
|||||||
#define GETEGID() (::syscall(SYS_getegid))
|
#define GETEGID() (::syscall(SYS_getegid))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace ugid
|
||||||
namespace mergerfs
|
|
||||||
{
|
{
|
||||||
namespace ugid
|
|
||||||
{
|
|
||||||
extern __thread uid_t currentuid;
|
extern __thread uid_t currentuid;
|
||||||
extern __thread gid_t currentgid;
|
extern __thread gid_t currentgid;
|
||||||
extern __thread bool initialized;
|
extern __thread bool initialized;
|
||||||
@ -112,7 +109,6 @@ namespace mergerfs
|
|||||||
const uid_t prevuid;
|
const uid_t prevuid;
|
||||||
const gid_t prevgid;
|
const gid_t prevgid;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef SETREUID
|
#undef SETREUID
|
||||||
|
@ -21,10 +21,8 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace mergerfs
|
namespace ugid
|
||||||
{
|
{
|
||||||
namespace ugid
|
|
||||||
{
|
|
||||||
__thread uid_t currentuid = 0;
|
__thread uid_t currentuid = 0;
|
||||||
__thread gid_t currentgid = 0;
|
__thread gid_t currentgid = 0;
|
||||||
__thread bool initialized = false;
|
__thread bool initialized = false;
|
||||||
@ -33,5 +31,4 @@ namespace mergerfs
|
|||||||
init()
|
init()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,8 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
namespace mergerfs
|
namespace ugid
|
||||||
{
|
{
|
||||||
namespace ugid
|
|
||||||
{
|
|
||||||
extern uid_t currentuid;
|
extern uid_t currentuid;
|
||||||
extern gid_t currentgid;
|
extern gid_t currentgid;
|
||||||
extern pthread_rwlock_t rwlock;
|
extern pthread_rwlock_t rwlock;
|
||||||
@ -97,5 +95,4 @@ namespace mergerfs
|
|||||||
const uid_t prevuid;
|
const uid_t prevuid;
|
||||||
const gid_t prevgid;
|
const gid_t prevgid;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,8 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace mergerfs
|
namespace ugid
|
||||||
{
|
{
|
||||||
namespace ugid
|
|
||||||
{
|
|
||||||
uid_t currentuid;
|
uid_t currentuid;
|
||||||
gid_t currentgid;
|
gid_t currentgid;
|
||||||
pthread_rwlock_t rwlock;
|
pthread_rwlock_t rwlock;
|
||||||
@ -44,5 +42,4 @@ namespace mergerfs
|
|||||||
currentuid = ::geteuid();
|
currentuid = ::geteuid();
|
||||||
currentgid = ::getegid();
|
currentgid = ::getegid();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user