diff options
author | Marc Brinkmann <git@marcbrinkmann.de> | 2016-01-27 17:15:52 +0100 |
---|---|---|
committer | Kamal Marhubi <kamal@marhubi.com> | 2016-01-27 15:10:42 -0500 |
commit | d391523c0ec4bda1d3940255f3a52770906371d0 (patch) | |
tree | 53599d8ab2ba616614dafd930422c2bb6e5f85d0 /src | |
parent | 5d0871c9f06c40d648787a90c5a73be33436f9e5 (diff) | |
download | nix-d391523c0ec4bda1d3940255f3a52770906371d0.zip |
Use function name as it is used in C.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/if_.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/net/if_.rs b/src/net/if_.rs index 6a55738b..d62af4fa 100644 --- a/src/net/if_.rs +++ b/src/net/if_.rs @@ -3,12 +3,13 @@ //! Uses Linux and/or POSIX functions to resolve interface names like "eth0" //! or "socan1" into device numbers. -use libc::{c_uint, if_nametoindex}; +use libc; +use libc::c_uint; use std::ffi::{CString, NulError}; use ::{Result, Error}; /// Resolve an interface into a interface number. -pub fn name_to_index(name: &str) -> Result<c_uint> { +pub fn if_nametoindex(name: &str) -> Result<c_uint> { let name = match CString::new(name) { Err(e) => match e { NulError(..) => { // A NulError indicates that a '\0' was found inside the string, @@ -26,7 +27,7 @@ pub fn name_to_index(name: &str) -> Result<c_uint> { let if_index; unsafe { - if_index = if_nametoindex(name.as_ptr()); + if_index = libc::if_nametoindex(name.as_ptr()); } if if_index == 0 { Err(Error::last()) } else { Ok(if_index) } |