Commit dbab1946 authored by Ramon Nou's avatar Ramon Nou
Browse files

fix(client): return error in hook_chdir if internal target directory does not exist

parent 003c5231
Loading
Loading
Loading
Loading
+6 −5
Changes for src/client/hooks.cpp: 6 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -1063,18 +1063,19 @@ hook_chdir(const char* path) {
    bool internal = CTX->relativize_path(path, rel_path);
    if(internal) {
        // path falls in our namespace
        /* This get_metadata gets stuck after a forkandExec */
        /*auto md = gkfs::utils::get_metadata(rel_path);
        if(!rel_path.empty() && rel_path != "/") {
            auto md = gkfs::utils::get_metadata(rel_path);
            if(!md) {
            LOG(ERROR, "{}() path {} / {} errno {}", __func__, path, rel_path,
                LOG(DEBUG, "{}() path {} / {} errno {}", __func__, path, rel_path,
                    errno);
                return -errno;
            }

            if(!S_ISDIR(md->mode())) {
            LOG(ERROR, "{}() path is not a directory", __func__);
                LOG(DEBUG, "{}() path is not a directory", __func__);
                return -ENOTDIR;
        }*/
            }
        }
        // TODO get complete path from relativize_path instead of
        // removing mountdir and then adding again here
        rel_path.insert(0, CTX->mountdir());