From b46a0720ae20931f2bdc5e0f01155d2aae2a45ce Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 20 Sep 2021 08:13:28 +0200 Subject: [PATCH] atomic_open_or_create_file: catch unsupported flag OFlag::O_DIRECTORY --- 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 6ae4c8af..3283d04e 100644 --- a/proxmox/src/tools/fs.rs +++ b/proxmox/src/tools/fs.rs @@ -205,6 +205,10 @@ pub fn atomic_open_or_create_file>( 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