Unverified Commit f8c2b1b6 authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

Move O_DIRECTORY check inside adafs_open

parent 58fe59e8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -19,6 +19,12 @@ int adafs_open(const std::string& path, mode_t mode, int flags) {
        return -1;
    }

    if(flags & O_DIRECTORY){
        CTX->log()->error("{}() `O_DIRECTORY` flag is not supported", __func__);
        errno = ENOTSUP;
        return -1;
    }

    if (flags & O_CREAT){
        // no access check required here. If one is using our FS they have the permissions.
        err = adafs_mk_node(path, mode | S_IFREG);
+0 −6
Original line number Diff line number Diff line
@@ -26,12 +26,6 @@ int open(const char* path, int flags, ...) {

    if(CTX->initialized()) {
        CTX->log()->trace("{}() called with path {}", __func__, path);
        if(flags & O_DIRECTORY){
            CTX->log()->error("{}() called with `O_DIRECTORY` flag on {}", __func__, path);
            errno = ENOTSUP;
            return -1;
        }

        std::string rel_path(path);
        if (CTX->relativize_path(rel_path)) {
            return adafs_open(rel_path, mode, flags);