Compare commits

...
1 Commits
Author SHA1 Message Date
Antonio SJ Musumeci 7f52942d12 rmdir: change error handling
* return first error that isn't ENOENT
* return ENOENT if no successes
* else return 0
2020-08-10 15:50:56 -04:00
+10 -7
View File
@@ -35,17 +35,13 @@ namespace l
static
int
rmdir_loop_core(const string &basepath_,
const char *fusepath_,
const int error_)
const char *fusepath_)
{
int rv;
string fullpath;
fullpath = fs::path::make(basepath_,fusepath_);
rv = fs::rmdir(fullpath);
return error::calc(rv,error_,errno);
return fs::rmdir(fullpath);
}
@@ -54,12 +50,19 @@ namespace l
rmdir_loop(const vector<string> &basepaths_,
const char *fusepath_)
{
int rv;
int error;
error = -1;
for(size_t i = 0, ei = basepaths_.size(); i != ei; i++)
{
error = l::rmdir_loop_core(basepaths_[i],fusepath_,error);
rv = l::rmdir_loop_core(basepaths_[i],fusepath_);
if((rv == -1) && (errno != ENOENT))
return rv;
if((rv == -1) && (errno == ENOENT))
error = ((error == -1) ? ENOENT : 0);
else
error = 0;
}
return -error;