diff --git a/src/chmod.cpp b/src/chmod.cpp index 123f3b60..13280a36 100644 --- a/src/chmod.cpp +++ b/src/chmod.cpp @@ -45,7 +45,7 @@ _chmod_loop_core(const string *basepath, rv = fs::chmod(fullpath,mode); - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } static diff --git a/src/chown.cpp b/src/chown.cpp index b0f210e3..2c15ffc1 100644 --- a/src/chown.cpp +++ b/src/chown.cpp @@ -47,7 +47,7 @@ _chown_loop_core(const string *basepath, rv = fs::lchown(fullpath,uid,gid); - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } static diff --git a/src/link.cpp b/src/link.cpp index bae5232e..3f128568 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -59,7 +59,7 @@ _link_create_path_core(const string &oldbasepath, rv = fs::link(oldfullpath,newfullpath); - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } static @@ -176,7 +176,7 @@ _link_preserve_path_core(Policy::Func::Search searchFunc, rv = fs::link(oldfullpath,newfullpath); } - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } static diff --git a/src/mkdir.cpp b/src/mkdir.cpp index 819da15d..c054b321 100644 --- a/src/mkdir.cpp +++ b/src/mkdir.cpp @@ -71,7 +71,7 @@ _mkdir_loop_core(const string &existingpath, rv = _mkdir_core(fullpath,mode,umask); - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } static diff --git a/src/mknod.cpp b/src/mknod.cpp index db14e980..b5033c1f 100644 --- a/src/mknod.cpp +++ b/src/mknod.cpp @@ -73,7 +73,7 @@ _mknod_loop_core(const string &existingpath, rv = _mknod_core(fullpath,mode,umask,dev); - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } static diff --git a/src/removexattr.cpp b/src/removexattr.cpp index f7398615..2bd47d36 100644 --- a/src/removexattr.cpp +++ b/src/removexattr.cpp @@ -45,7 +45,7 @@ _removexattr_loop_core(const string *basepath, rv = fs::lremovexattr(fullpath,attrname); - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } static diff --git a/src/rename.cpp b/src/rename.cpp index 41cc3c0e..f01ed068 100644 --- a/src/rename.cpp +++ b/src/rename.cpp @@ -103,7 +103,7 @@ _rename_create_path_core(const vector &oldbasepaths, rv = _rename(oldbasepath,oldfullpath, newbasepath,newfusedirpath,newfullpath); - error = calc_error(rv,error,errno); + error = error::calc(rv,error,errno); if(RENAME_FAILED(rv)) tounlink.push_back(oldfullpath); } @@ -241,7 +241,7 @@ _rename_preserve_path_core(Policy::Func::Search searchFunc, rv = fs::rename(oldfullpath,newfullpath); } - error = calc_error(rv,error,errno); + error = error::calc(rv,error,errno); if(RENAME_FAILED(rv)) toremove.push_back(oldfullpath); } diff --git a/src/rmdir.cpp b/src/rmdir.cpp index 4c804379..d64bf633 100644 --- a/src/rmdir.cpp +++ b/src/rmdir.cpp @@ -45,7 +45,7 @@ _rmdir_loop_core(const string *basepath, rv = fs::rmdir(fullpath); - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } diff --git a/src/rv.hpp b/src/rv.hpp index ca48e768..b2ec9243 100644 --- a/src/rv.hpp +++ b/src/rv.hpp @@ -17,21 +17,24 @@ #ifndef __RV_HPP__ #define __RV_HPP__ -static -inline -int -calc_error(const int rv, - const int prev, - const int cur) +namespace error { - if(rv == -1) - { - if(prev == 0) - return 0; - return cur; - } + static + inline + int + calc(const int rv, + const int prev, + const int cur) + { + if(rv == -1) + { + if(prev == 0) + return 0; + return cur; + } - return 0; + return 0; + } } #endif // __RV_HPP__ diff --git a/src/setxattr.cpp b/src/setxattr.cpp index 92444750..1b7b8a56 100644 --- a/src/setxattr.cpp +++ b/src/setxattr.cpp @@ -303,7 +303,7 @@ _setxattr_loop_core(const string *basepath, rv = fs::lsetxattr(fullpath,attrname,attrval,attrvalsize,flags); - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } static diff --git a/src/symlink.cpp b/src/symlink.cpp index 8ec2a5b9..d41d01c0 100644 --- a/src/symlink.cpp +++ b/src/symlink.cpp @@ -58,7 +58,7 @@ _symlink_loop_core(const string &existingpath, rv = ::symlink(oldpath,fullnewpath.c_str()); - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } static diff --git a/src/truncate.cpp b/src/truncate.cpp index 035beb53..db43592e 100644 --- a/src/truncate.cpp +++ b/src/truncate.cpp @@ -48,7 +48,7 @@ _truncate_loop_core(const string *basepath, rv = fs::truncate(fullpath,size); - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } static diff --git a/src/unlink.cpp b/src/unlink.cpp index 4ace660d..9cf403e2 100644 --- a/src/unlink.cpp +++ b/src/unlink.cpp @@ -46,7 +46,7 @@ _unlink_loop_core(const string *basepath, rv = fs::unlink(fullpath); - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } static diff --git a/src/utimens.cpp b/src/utimens.cpp index ddf57b84..e99700a2 100644 --- a/src/utimens.cpp +++ b/src/utimens.cpp @@ -47,7 +47,7 @@ _utimens_loop_core(const string *basepath, rv = fs::lutime(fullpath,ts); - return calc_error(rv,error,errno); + return error::calc(rv,error,errno); } static