You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.3 KiB

  1. /*
  2. Copyright (c) 2019, Antonio SJ Musumeci <trapexit@spawn.link>
  3. Permission to use, copy, modify, and/or distribute this software for any
  4. purpose with or without fee is hereby granted, provided that the above
  5. copyright notice and this permission notice appear in all copies.
  6. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  7. WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  8. MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  9. ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  10. WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  11. ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  12. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  13. */
  14. #include "errno.hpp"
  15. #include "fileinfo.hpp"
  16. #include "fs_fchmod.hpp"
  17. #include "fuse.h"
  18. namespace l
  19. {
  20. static
  21. int
  22. fchmod(const int fd_,
  23. const mode_t mode_)
  24. {
  25. int rv;
  26. rv = fs::fchmod(fd_,mode_);
  27. if(rv == -1)
  28. return -errno;
  29. return rv;
  30. }
  31. }
  32. namespace FUSE
  33. {
  34. int
  35. fchmod(const fuse_file_info_t *ffi_,
  36. const mode_t mode_)
  37. {
  38. FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
  39. return l::fchmod(fi->fd,mode_);
  40. }
  41. }