Commit 96114baf authored by Ramon Nou's avatar Ramon Nou
Browse files

fix libc statx

parent 11251b5f
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1166,6 +1166,14 @@ statx(int dirfd, const char* path, int flags, unsigned int mask,
      struct statx* statxbuf) {
    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);
    }

    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