Resolve "new kernels seem to use fstatat with EMPTY_PATH"

Closes #175 (closed)

Edited by Ramon Nou

Merge request reports

Loading
+0 −5
Changes for src/client/hooks.cpp: 0 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -203,11 +203,6 @@ hook_fstatat(int dirfd, const char* cpath, struct stat* buf, int flags) {
    LOG(DEBUG, "{}() called with path: \"{}\", fd: {}, buf: {}, flags: {}",
        __func__, cpath, dirfd, fmt::ptr(buf), flags);

    if(flags & AT_EMPTY_PATH) {
        LOG(ERROR, "{}() AT_EMPTY_PATH flag not supported", __func__);
        return -ENOTSUP;
    }

    std::string resolved;
    auto rstatus = CTX->relativize_fd_path(dirfd, cpath, resolved);
    switch(rstatus) {
+3 −2
Changes for src/client/preload_context.cpp: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ PreloadContext::relativize_fd_path(int dirfd, const char* raw_path,

    std::string path;

    if(raw_path[0] != gkfs::path::separator) {
    if(raw_path != nullptr && raw_path[0] != gkfs::path::separator) {
        // path is relative
        if(dirfd == AT_FDCWD) {
            // path is relative to cwd
@@ -243,7 +243,7 @@ PreloadContext::relativize_path(const char* raw_path,

    std::string path;

    if(raw_path[0] != gkfs::path::separator) {
    if(raw_path != nullptr && raw_path[0] != gkfs::path::separator) {
        /* Path is not absolute, we need to prepend CWD;
         * First reserve enough space to minimize memory copy
         */
@@ -251,6 +251,7 @@ PreloadContext::relativize_path(const char* raw_path,
    } else {
        path = raw_path;
    }

    return gkfs::path::resolve(path, relative_path, resolve_last_link);
}

Loading