From 86315adb23718885d7c8e24187a5484a43e34151 Mon Sep 17 00:00:00 2001 From: Ruoqing He Date: Fri, 18 Oct 2024 17:36:51 +0800 Subject: [PATCH] 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 --- net_util/src/tap.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net_util/src/tap.rs b/net_util/src/tap.rs index d700bc3f7..07a6e072c 100644 --- a/net_util/src/tap.rs +++ b/net_util/src/tap.rs @@ -124,7 +124,7 @@ impl Tap { // Open calls are safe because we give a constant null-terminated // string and verify the result. 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), ) };