瀏覽代碼

Add a missing \0 in a C string.

whitequark 7 年之前
父節點
當前提交
d9458c060b
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/phy/sys/tap_interface.rs

+ 1 - 1
src/phy/sys/tap_interface.rs

@@ -13,7 +13,7 @@ pub struct TapInterfaceDesc {
 impl TapInterfaceDesc {
     pub fn new(name: &str) -> io::Result<TapInterfaceDesc> {
         let lower = unsafe {
-            let lower = libc::open("/dev/net/tun".as_ptr() as *const libc::c_char,
+            let lower = libc::open("/dev/net/tun\0".as_ptr() as *const libc::c_char,
                                    libc::O_RDWR);
             if lower == -1 { return Err(io::Error::last_os_error()) }
             lower