atomic_open_or_create_file: catch unsupported flag OFlag::O_DIRECTORY

This commit is contained in:
Dietmar Maurer 2021-09-20 08:13:28 +02:00
parent c7e1a1f3c8
commit b46a0720ae

View File

@ -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