diff -r 7dd45173f68a -r 285d483db2fb src/server/plugins/postgresql/vfs.c --- a/src/server/plugins/postgresql/vfs.c Sat Apr 16 14:36:08 2022 +0200 +++ b/src/server/plugins/postgresql/vfs.c Sat Apr 16 21:05:29 2022 +0200 @@ -136,6 +136,10 @@ } // resdata will be freed automatically when the request is finished + return pg_vfs_create_from_resourcedata(sn, rq, resdata); +} + +VFS* pg_vfs_create_from_resourcedata(Session *sn, Request *rq, ResourceData *resdata) { // Create a new VFS object and a separate instance object // VFS contains fptrs that can be copied from pg_vfs_class // instance contains request specific data (PGconn) @@ -412,7 +416,12 @@ fd = -2; } - int lo_mode = INV_READ; // TODO: evaluate oflags + int lo_mode = INV_READ; + if((oflags & O_RDWR) == O_RDWR) { + lo_mode = INV_READ|INV_WRITE; + } else if((oflags & O_WRONLY) == O_WRONLY) { + lo_mode = INV_WRITE; + } fd = lo_open(pg->connection, oid, lo_mode); }