mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-29 17:15:57 +00:00
tools: create_dir: pass EEXIST to the caller
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
3c284b131d
commit
867a530724
@ -217,7 +217,7 @@ impl CreateOptions {
|
|||||||
|
|
||||||
/// Creates directory at the provided path with specified ownership.
|
/// Creates directory at the provided path with specified ownership.
|
||||||
///
|
///
|
||||||
/// Simply returns if the directory already exists.
|
/// Errors if the directory already exists.
|
||||||
pub fn create_dir<P: AsRef<Path>>(path: P, options: CreateOptions) -> Result<(), nix::Error> {
|
pub fn create_dir<P: AsRef<Path>>(path: P, options: CreateOptions) -> Result<(), nix::Error> {
|
||||||
// clippy bug?: from_bits_truncate is actually a const fn...
|
// clippy bug?: from_bits_truncate is actually a const fn...
|
||||||
#[allow(clippy::or_fun_call)]
|
#[allow(clippy::or_fun_call)]
|
||||||
@ -229,9 +229,6 @@ pub fn create_dir<P: AsRef<Path>>(path: P, options: CreateOptions) -> Result<(),
|
|||||||
|
|
||||||
match nix::unistd::mkdir(path, mode) {
|
match nix::unistd::mkdir(path, mode) {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
Err(nix::Error::Sys(Errno::EEXIST)) => {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
err => return err,
|
err => return err,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user