Browse Source

restructure error calculation

pull/361/head
Antonio SJ Musumeci 8 years ago
parent
commit
726b88e039
  1. 2
      src/chmod.cpp
  2. 2
      src/chown.cpp
  3. 4
      src/link.cpp
  4. 2
      src/mkdir.cpp
  5. 2
      src/mknod.cpp
  6. 2
      src/removexattr.cpp
  7. 4
      src/rename.cpp
  8. 2
      src/rmdir.cpp
  9. 13
      src/rv.hpp
  10. 2
      src/setxattr.cpp
  11. 2
      src/symlink.cpp
  12. 2
      src/truncate.cpp
  13. 2
      src/unlink.cpp
  14. 2
      src/utimens.cpp

2
src/chmod.cpp

@ -45,7 +45,7 @@ _chmod_loop_core(const string *basepath,
rv = fs::chmod(fullpath,mode); rv = fs::chmod(fullpath,mode);
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }
static static

2
src/chown.cpp

@ -47,7 +47,7 @@ _chown_loop_core(const string *basepath,
rv = fs::lchown(fullpath,uid,gid); rv = fs::lchown(fullpath,uid,gid);
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }
static static

4
src/link.cpp

@ -59,7 +59,7 @@ _link_create_path_core(const string &oldbasepath,
rv = fs::link(oldfullpath,newfullpath); rv = fs::link(oldfullpath,newfullpath);
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }
static static
@ -176,7 +176,7 @@ _link_preserve_path_core(Policy::Func::Search searchFunc,
rv = fs::link(oldfullpath,newfullpath); rv = fs::link(oldfullpath,newfullpath);
} }
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }
static static

2
src/mkdir.cpp

@ -71,7 +71,7 @@ _mkdir_loop_core(const string &existingpath,
rv = _mkdir_core(fullpath,mode,umask); rv = _mkdir_core(fullpath,mode,umask);
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }
static static

2
src/mknod.cpp

@ -73,7 +73,7 @@ _mknod_loop_core(const string &existingpath,
rv = _mknod_core(fullpath,mode,umask,dev); rv = _mknod_core(fullpath,mode,umask,dev);
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }
static static

2
src/removexattr.cpp

@ -45,7 +45,7 @@ _removexattr_loop_core(const string *basepath,
rv = fs::lremovexattr(fullpath,attrname); rv = fs::lremovexattr(fullpath,attrname);
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }
static static

4
src/rename.cpp

@ -103,7 +103,7 @@ _rename_create_path_core(const vector<const string*> &oldbasepaths,
rv = _rename(oldbasepath,oldfullpath, rv = _rename(oldbasepath,oldfullpath,
newbasepath,newfusedirpath,newfullpath); newbasepath,newfusedirpath,newfullpath);
error = calc_error(rv,error,errno);
error = error::calc(rv,error,errno);
if(RENAME_FAILED(rv)) if(RENAME_FAILED(rv))
tounlink.push_back(oldfullpath); tounlink.push_back(oldfullpath);
} }
@ -241,7 +241,7 @@ _rename_preserve_path_core(Policy::Func::Search searchFunc,
rv = fs::rename(oldfullpath,newfullpath); rv = fs::rename(oldfullpath,newfullpath);
} }
error = calc_error(rv,error,errno);
error = error::calc(rv,error,errno);
if(RENAME_FAILED(rv)) if(RENAME_FAILED(rv))
toremove.push_back(oldfullpath); toremove.push_back(oldfullpath);
} }

2
src/rmdir.cpp

@ -45,7 +45,7 @@ _rmdir_loop_core(const string *basepath,
rv = fs::rmdir(fullpath); rv = fs::rmdir(fullpath);
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }

13
src/rv.hpp

@ -17,13 +17,15 @@
#ifndef __RV_HPP__ #ifndef __RV_HPP__
#define __RV_HPP__ #define __RV_HPP__
static
inline
int
calc_error(const int rv,
namespace error
{
static
inline
int
calc(const int rv,
const int prev, const int prev,
const int cur) const int cur)
{
{
if(rv == -1) if(rv == -1)
{ {
if(prev == 0) if(prev == 0)
@ -32,6 +34,7 @@ calc_error(const int rv,
} }
return 0; return 0;
}
} }
#endif // __RV_HPP__ #endif // __RV_HPP__

2
src/setxattr.cpp

@ -303,7 +303,7 @@ _setxattr_loop_core(const string *basepath,
rv = fs::lsetxattr(fullpath,attrname,attrval,attrvalsize,flags); rv = fs::lsetxattr(fullpath,attrname,attrval,attrvalsize,flags);
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }
static static

2
src/symlink.cpp

@ -58,7 +58,7 @@ _symlink_loop_core(const string &existingpath,
rv = ::symlink(oldpath,fullnewpath.c_str()); rv = ::symlink(oldpath,fullnewpath.c_str());
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }
static static

2
src/truncate.cpp

@ -48,7 +48,7 @@ _truncate_loop_core(const string *basepath,
rv = fs::truncate(fullpath,size); rv = fs::truncate(fullpath,size);
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }
static static

2
src/unlink.cpp

@ -46,7 +46,7 @@ _unlink_loop_core(const string *basepath,
rv = fs::unlink(fullpath); rv = fs::unlink(fullpath);
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }
static static

2
src/utimens.cpp

@ -47,7 +47,7 @@ _utimens_loop_core(const string *basepath,
rv = fs::lutime(fullpath,ts); rv = fs::lutime(fullpath,ts);
return calc_error(rv,error,errno);
return error::calc(rv,error,errno);
} }
static static

Loading…
Cancel
Save