Commit 2fa96eb3 authored by Ramon Nou's avatar Ramon Nou
Browse files

Resolve "dup3 returns ENOTSUP"

parent 8d65f46b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
  - Export extra user library functions ([!227](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/227))
  
### Fixed

  - Dup3 is supported if O_CLOEXEC is not used (i.e. hexdump) ([!228](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/228))


## [0.9.4] - 2025-03
+5 −4
Original line number Diff line number Diff line
@@ -583,10 +583,11 @@ hook_dup3(unsigned int oldfd, unsigned int newfd, int flags) {
        oldfd, newfd, flags);

    if(CTX->file_map()->exist(oldfd)) {
        // TODO implement O_CLOEXEC flag first which is used with fcntl(2)
        // It is in glibc since kernel 2.9. So maybe not that important :)
        if(flags & O_CLOEXEC) {
            LOG(WARNING, "{}() Not supported", __func__);
            return -ENOTSUP;
        } else
            return with_errno(gkfs::syscall::gkfs_dup2(oldfd, newfd));
    }
    return gsl::narrow_cast<int>(
            syscall_no_intercept_wrapper(SYS_dup3, oldfd, newfd, flags));