Skip to content

Commit

Permalink
Merge pull request #83 from trapexit/enotsup
Browse files Browse the repository at this point in the history
ignore ENOTSUP errors when cloning paths. fixes #82
  • Loading branch information
trapexit committed Jul 13, 2015
2 parents 2ee3d4e + 4d60538 commit e4be3aa
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,23 @@ namespace fs
return set_fs_ioc_flags(to,flags);
}

static
bool
ignorable_error(const int err)
{
switch(err)
{
case ENOTTY:
case ENOTSUP:
#if ENOTSUP != EOPNOTSUPP
case EOPNOTSUPP:
#endif
return true;
}

return false;
}

int
clonepath(const string &fromsrc,
const string &tosrc,
Expand Down Expand Up @@ -464,11 +481,11 @@ namespace fs

// It may not support it... it's fine...
rv = copyattr(frompath,topath);
if(rv == -1 && errno != ENOTTY)
if(rv == -1 && !ignorable_error(errno))
return -1;

rv = copyxattrs(frompath,topath);
if(rv == -1 && errno != ENOTTY)
if(rv == -1 && !ignorable_error(errno))
return -1;

return 0;
Expand Down

0 comments on commit e4be3aa

Please sign in to comment.