Browse Source

make fs::attr return ENOTSUP on EINVAL #381

pull/385/head
Antonio SJ Musumeci 8 years ago
parent
commit
c043ef95a3
  1. 16
      src/fs_attr_linux.icpp
  2. 4
      src/fs_attr_unsupported.icpp

16
src/fs_attr_linux.icpp

@ -35,7 +35,13 @@ namespace fs
get_fs_ioc_flags(const int fd, get_fs_ioc_flags(const int fd,
int &flags) int &flags)
{ {
return fs::ioctl(fd,FS_IOC_GETFLAGS,(void*)&flags);
int rv;
rv = fs::ioctl(fd,FS_IOC_GETFLAGS,(void*)&flags);
if((rv == -1) && (errno == EINVAL))
errno = ENOTSUP;
return rv;
} }
static static
@ -68,7 +74,13 @@ namespace fs
set_fs_ioc_flags(const int fd, set_fs_ioc_flags(const int fd,
const int flags) const int flags)
{ {
return fs::ioctl(fd,FS_IOC_SETFLAGS,(void*)&flags);
int rv;
rv = fs::ioctl(fd,FS_IOC_SETFLAGS,(void*)&flags);
if((rv == -1) && (errno == EINVAL))
errno = ENOTSUP;
return rv;
} }
static static

4
src/fs_attr_unsupported.icpp

@ -26,14 +26,14 @@ namespace fs
copy(const int fdin, copy(const int fdin,
const int fdout) const int fdout)
{ {
return ENOTSUP;
return (errno=ENOTSUP,-1);
} }
int int
copy(const std::string &from, copy(const std::string &from,
const std::string &to) const std::string &to)
{ {
return ENOTSUP;
return (errno=ENOTSUP,-1);
} }
} }
} }
Loading…
Cancel
Save