mirror of
https://git.proxmox.com/git/proxmox
synced 2025-10-04 13:53:54 +00:00
sys: replace CStr::from_bytes_... with c"literals"
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
ba304a4f83
commit
dd36fec23d
@ -117,11 +117,7 @@ fn create_path_do(
|
|||||||
Some(Component::Prefix(_)) => bail!("illegal prefix path component encountered"),
|
Some(Component::Prefix(_)) => bail!("illegal prefix path component encountered"),
|
||||||
Some(Component::RootDir) => {
|
Some(Component::RootDir) => {
|
||||||
let _ = iter.next();
|
let _ = iter.next();
|
||||||
crate::fd::open(
|
crate::fd::open(c"/", OFlag::O_DIRECTORY, stat::Mode::empty())?
|
||||||
unsafe { CStr::from_bytes_with_nul_unchecked(b"/\0") },
|
|
||||||
OFlag::O_DIRECTORY,
|
|
||||||
stat::Mode::empty(),
|
|
||||||
)?
|
|
||||||
}
|
}
|
||||||
Some(Component::CurDir) => {
|
Some(Component::CurDir) => {
|
||||||
let _ = iter.next();
|
let _ = iter.next();
|
||||||
@ -129,11 +125,7 @@ fn create_path_do(
|
|||||||
}
|
}
|
||||||
Some(Component::ParentDir) => {
|
Some(Component::ParentDir) => {
|
||||||
let _ = iter.next();
|
let _ = iter.next();
|
||||||
crate::fd::open(
|
crate::fd::open(c"..", OFlag::O_DIRECTORY, stat::Mode::empty())?
|
||||||
unsafe { CStr::from_bytes_with_nul_unchecked(b"..\0") },
|
|
||||||
OFlag::O_DIRECTORY,
|
|
||||||
stat::Mode::empty(),
|
|
||||||
)?
|
|
||||||
}
|
}
|
||||||
Some(Component::Normal(_)) => {
|
Some(Component::Normal(_)) => {
|
||||||
// simply do not advance the iterator, heavy lifting happens in create_path_at_do()
|
// simply do not advance the iterator, heavy lifting happens in create_path_at_do()
|
||||||
@ -159,12 +151,7 @@ fn create_path_at_do(
|
|||||||
None => return Ok(created),
|
None => return Ok(created),
|
||||||
|
|
||||||
Some(Component::ParentDir) => {
|
Some(Component::ParentDir) => {
|
||||||
at = crate::fd::openat(
|
at = crate::fd::openat(&at, c"..", OFlag::O_DIRECTORY, stat::Mode::empty())?;
|
||||||
&at,
|
|
||||||
unsafe { CStr::from_bytes_with_nul_unchecked(b"..\0") },
|
|
||||||
OFlag::O_DIRECTORY,
|
|
||||||
stat::Mode::empty(),
|
|
||||||
)?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(Component::Normal(path)) => {
|
Some(Component::Normal(path)) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user