rem: if (!MY_S_ISDIR(st.st_mode)) { err = ENOTDIR;
add: if (!MY_S_ISDIR(st.mode)) { err = FS_ENOTDIR;
context: sys_chdir(bool kernel, int fd, const char *path){    int              err;    ioctx           *io;    vnode           *vn;    op_rstat        *op;    struct my_stat   st;    err = get_file_fd(kernel, fd, path, TRUE, &vn);    if (err)        goto error1;    op = vn->ns->fs->ops.rstat;    if (!op) {        err = EINVAL;        goto error2;    }    err = (*op)(vn->ns->data, vn->data, &st);    if (err)        goto error2;    if (!MY_S_ISDIR(st.st_mode)) {        err = ENOTDIR;        goto error2;    }    io = get_cur_ioctx();    LOCK(io->lock);    dec_vnode(io->cwd, FALSE);    io->cwd = vn;    UNLOCK(io->lock);    return 0;   error2:    dec_vnode(vn, FALSE);error1:    return err;}