Commit 389bf076 authored by Marc Vef's avatar Marc Vef
Browse files

Merge branch 'rnou/175-new-kernels-seem-to-use-fstatat-with-empty_path' into 'master'

Resolve "new kernels seem to use fstatat with EMPTY_PATH"

Closes #175

See merge request !116
parents d067bac5 8dd6e30a
Loading
Loading
Loading
Loading
Loading
+0 −5
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
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);
}