all action functions return success should at least one succeed. closes #189

This commit is contained in:
Antonio SJ Musumeci 2016-01-13 11:33:39 -05:00
parent f905116c3d
commit 4c77ac4d24
15 changed files with 321 additions and 286 deletions

View File

@ -1,33 +1,27 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2016 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <fuse.h>
#include <string> #include <string>
#include <vector> #include <vector>
@ -53,15 +47,15 @@ _access(Policy::Func::Search searchFunc,
const int mask) const int mask)
{ {
int rv; int rv;
vector<string> path; string path;
rv = searchFunc(srcmounts,fusepath,minfreespace,path); rv = searchFunc(srcmounts,fusepath,minfreespace,path);
if(rv == -1) if(rv == -1)
return -errno; return -errno;
fs::path::append(path[0],fusepath); fs::path::append(path,fusepath);
rv = ::eaccess(path[0].c_str(),mask); rv = ::eaccess(path.c_str(),mask);
return ((rv == -1) ? -errno : 0); return ((rv == -1) ? -errno : 0);
} }

View File

@ -1,25 +1,25 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2016 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <fuse.h> #include <fuse.h>
@ -30,6 +30,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "ugid.hpp" #include "ugid.hpp"
@ -53,14 +54,14 @@ _chmod(Policy::Func::Action actionFunc,
if(rv == -1) if(rv == -1)
return -errno; return -errno;
error = 0; error = -1;
for(size_t i = 0, ei = paths.size(); i != ei; i++) for(size_t i = 0, ei = paths.size(); i != ei; i++)
{ {
fs::path::append(paths[i],fusepath); fs::path::append(paths[i],fusepath);
rv = ::chmod(paths[i].c_str(),mode); rv = ::chmod(paths[i].c_str(),mode);
if(rv == -1)
error = errno; error = calc_error(rv,error,errno);
} }
return -error; return -error;

View File

@ -1,25 +1,25 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2016 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <fuse.h> #include <fuse.h>
@ -31,6 +31,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "ugid.hpp" #include "ugid.hpp"
@ -56,14 +57,14 @@ _chown(Policy::Func::Action actionFunc,
if(rv == -1) if(rv == -1)
return -errno; return -errno;
error = 0; error = -1;
for(size_t i = 0, ei = paths.size(); i != ei; i++) for(size_t i = 0, ei = paths.size(); i != ei; i++)
{ {
fs::path::append(paths[i],fusepath); fs::path::append(paths[i],fusepath);
rv = ::lchown(paths[i].c_str(),uid,gid); rv = ::lchown(paths[i].c_str(),uid,gid);
if(rv == -1)
error = errno; error = calc_error(rv,error,errno);
} }
return -error; return -error;

View File

@ -1,25 +1,25 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2016 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <fuse.h> #include <fuse.h>
@ -33,6 +33,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_clonepath.hpp" #include "fs_clonepath.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "ugid.hpp" #include "ugid.hpp"
@ -55,7 +56,7 @@ _single_link(Policy::Func::Search searchFunc,
const string fullnewpath = fs::path::make(base,newpath); const string fullnewpath = fs::path::make(base,newpath);
rv = ::link(fulloldpath.c_str(),fullnewpath.c_str()); rv = ::link(fulloldpath.c_str(),fullnewpath.c_str());
if(rv == -1 && errno == ENOENT) if((rv == -1) && (errno == ENOENT))
{ {
string newpathdir; string newpathdir;
vector<string> foundpath; vector<string> foundpath;
@ -93,12 +94,12 @@ _link(Policy::Func::Search searchFunc,
if(rv == -1) if(rv == -1)
return -errno; return -errno;
error = 0; error = -1;
for(size_t i = 0, ei = oldpaths.size(); i != ei; i++) for(size_t i = 0, ei = oldpaths.size(); i != ei; i++)
{ {
rv = _single_link(searchFunc,srcmounts,minfreespace,oldpaths[i],oldpath,newpath); rv = _single_link(searchFunc,srcmounts,minfreespace,oldpaths[i],oldpath,newpath);
if(rv == -1)
error = errno; error = calc_error(rv,error,errno);
} }
return -error; return -error;

View File

@ -1,25 +1,25 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2016 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <fuse.h> #include <fuse.h>
@ -34,6 +34,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_clonepath.hpp" #include "fs_clonepath.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "ugid.hpp" #include "ugid.hpp"
@ -67,7 +68,7 @@ _mkdir(Policy::Func::Search searchFunc,
if(rv == -1) if(rv == -1)
return -errno; return -errno;
error = 0; error = -1;
for(size_t i = 0, ei = createpaths.size(); i != ei; i++) for(size_t i = 0, ei = createpaths.size(); i != ei; i++)
{ {
string &createpath = createpaths[i]; string &createpath = createpaths[i];
@ -81,8 +82,8 @@ _mkdir(Policy::Func::Search searchFunc,
fs::path::append(createpath,fusepath); fs::path::append(createpath,fusepath);
rv = ::mkdir(createpath.c_str(),mode); rv = ::mkdir(createpath.c_str(),mode);
if(rv == -1)
error = errno; error = calc_error(rv,error,errno);
} }
return -error; return -error;

View File

@ -1,25 +1,25 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2016 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <fuse.h> #include <fuse.h>
@ -36,6 +36,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_clonepath.hpp" #include "fs_clonepath.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "ugid.hpp" #include "ugid.hpp"
@ -68,7 +69,7 @@ _mknod(Policy::Func::Search searchFunc,
if(rv == -1) if(rv == -1)
return -errno; return -errno;
error = 0; error = -1;
for(size_t i = 0, ei = createpaths.size(); i != ei; i++) for(size_t i = 0, ei = createpaths.size(); i != ei; i++)
{ {
string &createpath = createpaths[0]; string &createpath = createpaths[0];
@ -82,8 +83,8 @@ _mknod(Policy::Func::Search searchFunc,
fs::path::append(createpath,fusepath); fs::path::append(createpath,fusepath);
rv = ::mknod(createpath.c_str(),mode,dev); rv = ::mknod(createpath.c_str(),mode,dev);
if(rv == -1)
error = errno; error = calc_error(rv,error,errno);
} }
return -error; return -error;

View File

@ -1,25 +1,25 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2016 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <fuse.h> #include <fuse.h>
@ -32,6 +32,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "ugid.hpp" #include "ugid.hpp"
#include "xattr.hpp" #include "xattr.hpp"
@ -57,14 +58,14 @@ _removexattr(Policy::Func::Action actionFunc,
if(rv == -1) if(rv == -1)
return -errno; return -errno;
error = 0; error = -1;
for(size_t i = 0, ei = paths.size(); i != ei; i++) for(size_t i = 0, ei = paths.size(); i != ei; i++)
{ {
fs::path::append(paths[i],fusepath); fs::path::append(paths[i],fusepath);
rv = ::lremovexattr(paths[i].c_str(),attrname); rv = ::lremovexattr(paths[i].c_str(),attrname);
if(rv == -1)
error = errno; error = calc_error(rv,error,errno);
} }
return -error; return -error;

View File

@ -34,6 +34,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_clonepath.hpp" #include "fs_clonepath.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "ugid.hpp" #include "ugid.hpp"
@ -51,23 +52,6 @@ member(const vector<string> &haystack,
return (std::find(haystack.begin(),haystack.end(),needle) != haystack.end()); return (std::find(haystack.begin(),haystack.end(),needle) != haystack.end());
} }
// a single success trumps any failure
static
int
_process_rv(const int rv,
const int preverror,
const int error)
{
if(rv == -1)
{
if(preverror == 0)
return 0;
return error;
}
return 0;
}
static static
void void
_remove(const vector<string> &toremove) _remove(const vector<string> &toremove)
@ -106,7 +90,7 @@ _rename_create_path_one(const vector<string> &oldbasepaths,
fs::path::make(oldbasepath,oldfusepath,oldfullpath); fs::path::make(oldbasepath,oldfusepath,oldfullpath);
rv = ::rename(oldfullpath.c_str(),newfullpath.c_str()); rv = ::rename(oldfullpath.c_str(),newfullpath.c_str());
error = _process_rv(rv,error,errno); error = calc_error(rv,error,errno);
if(rv == -1) if(rv == -1)
tounlink.push_back(oldfullpath); tounlink.push_back(oldfullpath);
} }
@ -231,7 +215,7 @@ _rename_preserve_path_one(Policy::Func::Search searchFunc,
rv = ::rename(oldfullpath.c_str(),newfullpath.c_str()); rv = ::rename(oldfullpath.c_str(),newfullpath.c_str());
} }
error = _process_rv(rv,error,errno); error = calc_error(rv,error,errno);
if(rv == -1) if(rv == -1)
toremove.push_back(oldfullpath); toremove.push_back(oldfullpath);
} }

View File

@ -1,25 +1,25 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2016 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <fuse.h> #include <fuse.h>
@ -31,6 +31,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "ugid.hpp" #include "ugid.hpp"
@ -53,14 +54,14 @@ _rmdir(Policy::Func::Action actionFunc,
if(rv == -1) if(rv == -1)
return -errno; return -errno;
error = 0; error = -1;
for(size_t i = 0, ei = paths.size(); i != ei; i++) for(size_t i = 0, ei = paths.size(); i != ei; i++)
{ {
fs::path::append(paths[i],fusepath); fs::path::append(paths[i],fusepath);
rv = ::rmdir(paths[i].c_str()); rv = ::rmdir(paths[i].c_str());
if(rv == -1)
error = errno; error = calc_error(rv,error,errno);
} }
return -error; return -error;

45
src/rv.hpp Normal file
View File

@ -0,0 +1,45 @@
/*
The MIT License (MIT)
Copyright (c) 2016 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef __RV_HPP__
#define __RV_HPP__
static
inline
int
calc_error(const int rv,
const int prev,
const int cur)
{
if(rv == -1)
{
if(prev == 0)
return 0;
return cur;
}
return 0;
}
#endif // __RV_HPP__

View File

@ -1,25 +1,25 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2016 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <fuse.h> #include <fuse.h>
@ -35,6 +35,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "num.hpp" #include "num.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "str.hpp" #include "str.hpp"
#include "ugid.hpp" #include "ugid.hpp"
@ -314,14 +315,14 @@ _setxattr(Policy::Func::Action actionFunc,
if(rv == -1) if(rv == -1)
return -errno; return -errno;
error = 0; error = -1;
for(size_t i = 0, ei = paths.size(); i != ei; i++) for(size_t i = 0, ei = paths.size(); i != ei; i++)
{ {
fs::path::append(paths[i],fusepath); fs::path::append(paths[i],fusepath);
rv = ::lsetxattr(paths[i].c_str(),attrname,attrval,attrvalsize,flags); rv = ::lsetxattr(paths[i].c_str(),attrname,attrval,attrvalsize,flags);
if(rv == -1)
error = errno; error = calc_error(rv,error,errno);
} }
return -error; return -error;

View File

@ -1,25 +1,25 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <fuse.h> #include <fuse.h>
@ -31,6 +31,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "ugid.hpp" #include "ugid.hpp"
@ -56,14 +57,14 @@ _symlink(Policy::Func::Create createFunc,
if(rv == -1) if(rv == -1)
return -errno; return -errno;
error = 0; error = -1;
for(size_t i = 0, ei = newpathdirs.size(); i != ei; i++) for(size_t i = 0, ei = newpathdirs.size(); i != ei; i++)
{ {
fs::path::append(newpathdirs[i],newpath); fs::path::append(newpathdirs[i],newpath);
rv = symlink(oldpath.c_str(),newpathdirs[i].c_str()); rv = symlink(oldpath.c_str(),newpathdirs[i].c_str());
if(rv == -1)
error = errno; error = calc_error(rv,error,errno);
} }
return -error; return -error;

View File

@ -1,25 +1,25 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2016 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <fuse.h> #include <fuse.h>
@ -33,6 +33,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "ugid.hpp" #include "ugid.hpp"
@ -56,14 +57,14 @@ _truncate(Policy::Func::Action actionFunc,
if(rv == -1) if(rv == -1)
return -errno; return -errno;
error = 0; error = -1;
for(size_t i = 0, ei = paths.size(); i != ei; i++) for(size_t i = 0, ei = paths.size(); i != ei; i++)
{ {
fs::path::append(paths[i],fusepath); fs::path::append(paths[i],fusepath);
rv = ::truncate(paths[i].c_str(),size); rv = ::truncate(paths[i].c_str(),size);
if(rv == -1)
error = errno; error = calc_error(rv,error,errno);
} }
return -error; return -error;

View File

@ -1,25 +1,25 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <fuse.h> #include <fuse.h>
@ -32,6 +32,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "ugid.hpp" #include "ugid.hpp"
@ -54,14 +55,14 @@ _unlink(Policy::Func::Action actionFunc,
if(rv == -1) if(rv == -1)
return -errno; return -errno;
error = 0; error = -1;
for(size_t i = 0, ei = paths.size(); i != ei; i++) for(size_t i = 0, ei = paths.size(); i != ei; i++)
{ {
fs::path::append(paths[i],fusepath); fs::path::append(paths[i],fusepath);
rv = ::unlink(paths[i].c_str()); rv = ::unlink(paths[i].c_str());
if(rv == -1)
error = errno; error = calc_error(rv,error,errno);
} }
return -error; return -error;

View File

@ -1,25 +1,25 @@
/* /*
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link> Copyright (c) 2016 Antonio SJ Musumeci <trapexit@spawn.link>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
*/ */
#include <fuse.h> #include <fuse.h>
@ -33,6 +33,7 @@
#include "config.hpp" #include "config.hpp"
#include "fs_path.hpp" #include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp" #include "rwlock.hpp"
#include "ugid.hpp" #include "ugid.hpp"
@ -56,14 +57,14 @@ _utimens(Policy::Func::Action actionFunc,
if(rv == -1) if(rv == -1)
return -errno; return -errno;
error = 0; error = -1;
for(size_t i = 0, ei = paths.size(); i != ei; i++) for(size_t i = 0, ei = paths.size(); i != ei; i++)
{ {
fs::path::append(paths[i],fusepath); fs::path::append(paths[i],fusepath);
rv = ::utimensat(0,paths[i].c_str(),ts,AT_SYMLINK_NOFOLLOW); rv = ::utimensat(0,paths[i].c_str(),ts,AT_SYMLINK_NOFOLLOW);
if(rv == -1)
error = errno; error = calc_error(rv,error,errno);
} }
return -error; return -error;