Commit 4df2d4b5 authored by Ramon Nou's avatar Ramon Nou
Browse files

fix statx nullptr log

parent 96114baf
Loading
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -1167,14 +1167,9 @@ statx(int dirfd, const char* path, int flags, unsigned int mask,
    gkfs_init_routine_placeholder();
    bool follow_link = (flags & AT_SYMLINK_NOFOLLOW) == 0;

    // When AT_EMPTY_PATH is set, path may legally be nullptr or empty ("").
    // In that case forward directly to the native statx to avoid a
    // null-pointer dereference inside fmt::format.
    if(path == nullptr || (flags & AT_EMPTY_PATH) != 0) {
        GKFS_FALLBACK(statx, dirfd, path, flags, mask, statxbuf);
    }

    if(path != nullptr) {
        DEBUG_INFO("[STATX] For path '{}', follow_link: {}", path, follow_link);
    }
    // GekkoFS path operation macro for statx needs 'follow_link' passed
    // correctly. The original GKFS_PATH_OPERATION_DIR doesn't account for the
    // follow_link param to gkfs_statx We might need a custom block or an
+4 −11
Original line number Diff line number Diff line
@@ -155,18 +155,11 @@ hook_statx(int dirfd, const char* path, int flags, unsigned int mask,
           struct ::statx* buf) {
    bool follow = (flags & AT_SYMLINK_NOFOLLOW) == 0;

    // When AT_EMPTY_PATH is set, path may legally be nullptr or "".
    // In that case it is an fstat-style call on an fd; forward directly to
    // the kernel to avoid a null-pointer dereference in fmt::format.
    if(path == nullptr || (flags & AT_EMPTY_PATH) != 0) {
        return gsl::narrow_cast<int>(syscall_no_intercept_wrapper(
                SYS_statx, dirfd, path, flags, mask, buf));
    }

    if(path != nullptr) {
        LOG(DEBUG,
            "{}() called with dirfd: '{}', path: \"{}\", flags: '{}', mask: '{}', buf: '{}'",
            __func__, dirfd, path, flags, mask, fmt::ptr(buf));

    }

    std::string resolved;
    auto rstatus = CTX->relativize_fd_path(dirfd, path, resolved);