Hi All, please help me find crate having this method already implemented. Linux method link - open_excl(3): open file for exclusive writing - Linux man page
It seems like it’s not a standard posix function. Based on this stack overflow article it seems like it is just using open(..)
with O_EXCL
and with mode 0600
. This can be replicated using the standard library with
use std::os::unix::fs::OpenOptionsExt;
let f = std::fs::OpenOptions::new().create_new(true).mode(0o600).open(path_to_file)?;
1 Like
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.