mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: Use c"" to construct nul-terminated string
As clippy of rust-toolchain version 1.83.0-beta.1 suggests, use `c""` to construct nul-terminated `CStr`. Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
+1
-1
@@ -124,7 +124,7 @@ impl Tap {
|
|||||||
// Open calls are safe because we give a constant null-terminated
|
// Open calls are safe because we give a constant null-terminated
|
||||||
// string and verify the result.
|
// string and verify the result.
|
||||||
libc::open(
|
libc::open(
|
||||||
b"/dev/net/tun\0".as_ptr() as *const c_char,
|
c"/dev/net/tun".as_ptr() as *const c_char,
|
||||||
flags.unwrap_or(libc::O_RDWR | libc::O_NONBLOCK | libc::O_CLOEXEC),
|
flags.unwrap_or(libc::O_RDWR | libc::O_NONBLOCK | libc::O_CLOEXEC),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user