aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2017-01-15 16:39:22 -0800
committerJoe Wilm <joe@jwilm.com>2017-01-15 16:39:22 -0800
commita2cd4b647c1058c3012348774481ade30dddd601 (patch)
tree9da706db73cca723c4792c100b7c07c4d41d33a9 /src
parent67aba7f4e4758c5fcb7eda50f083b138017fbfdb (diff)
downloadalacritty-a2cd4b647c1058c3012348774481ade30dddd601.tar.gz
alacritty-a2cd4b647c1058c3012348774481ade30dddd601.zip
Cleanup getpwuid_r wrapper
The wrapper had some transmutes still from an earlier implementation, and they are not needed now.
Diffstat (limited to 'src')
-rw-r--r--src/tty.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/tty.rs b/src/tty.rs
index ad89397d..c9feae36 100644
--- a/src/tty.rs
+++ b/src/tty.rs
@@ -17,7 +17,6 @@
use std::env;
use std::ffi::CStr;
use std::fs::File;
-use std::mem;
use std::os::unix::io::FromRawFd;
use std::ptr;
@@ -192,13 +191,13 @@ fn get_pw_entry(buf: &mut [i8; 1024]) -> Passwd {
// Transmute is used here to conveniently cast from the raw CStr to a &str with the appropriate
// lifetime.
Passwd {
- name: unsafe { mem::transmute(CStr::from_ptr(entry.pw_name).to_str().unwrap()) },
- passwd: unsafe { mem::transmute(CStr::from_ptr(entry.pw_passwd).to_str().unwrap()) },
+ name: unsafe { CStr::from_ptr(entry.pw_name).to_str().unwrap() },
+ passwd: unsafe { CStr::from_ptr(entry.pw_passwd).to_str().unwrap() },
uid: entry.pw_uid,
gid: entry.pw_gid,
- gecos: unsafe { mem::transmute(CStr::from_ptr(entry.pw_gecos).to_str().unwrap()) },
- dir: unsafe { mem::transmute(CStr::from_ptr(entry.pw_dir).to_str().unwrap()) },
- shell: unsafe { mem::transmute(CStr::from_ptr(entry.pw_shell).to_str().unwrap()) },
+ gecos: unsafe { CStr::from_ptr(entry.pw_gecos).to_str().unwrap() },
+ dir: unsafe { CStr::from_ptr(entry.pw_dir).to_str().unwrap() },
+ shell: unsafe { CStr::from_ptr(entry.pw_shell).to_str().unwrap() },
}
}