[pbs-devel] [PATCH proxmox 1/2] atomic_open_or_create_file: catch unsupported flag OFlag::O_DIRECTORY

Dietmar Maurer dietmar at proxmox.com
Mon Sep 20 08:36:13 CEST 2021


---
 proxmox/src/tools/fs.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/proxmox/src/tools/fs.rs b/proxmox/src/tools/fs.rs
index 6ae4c8a..3283d04 100644
--- a/proxmox/src/tools/fs.rs
+++ b/proxmox/src/tools/fs.rs
@@ -205,6 +205,10 @@ pub fn atomic_open_or_create_file<P: AsRef<Path>>(
         bail!("open {:?} failed - unsupported OFlag O_TMPFILE", path);
     }
 
+    if oflag.contains(OFlag::O_DIRECTORY) {
+        bail!("open {:?} failed - unsupported OFlag O_DIRECTORY", path);
+    }
+
     oflag.remove(OFlag::O_CREAT); // we want to handle CREAT ourselfes
 
     // Note: 'mode' is ignored, because oflag does not contain O_CREAT or O_TMPFILE
-- 
2.30.2






More information about the pbs-devel mailing list