From 0956ab8804ab138b2ca28fa1e786f0981eabc2d8 Mon Sep 17 00:00:00 2001 From: Michael Gehring Date: Sun, 15 Jun 2014 12:22:05 +0200 Subject: [PATCH] c_types: fix c_passwd (struct passwd) memory layout on linux --- common/c_types.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/common/c_types.rs b/common/c_types.rs index 55f64809a..1846a296c 100644 --- a/common/c_types.rs +++ b/common/c_types.rs @@ -6,8 +6,8 @@ use self::libc::{ c_char, c_int, uid_t, - time_t }; +#[cfg(target_os = "macos")] use self::libc::time_t; use self::libc::funcs::posix88::unistd::getgroups; use std::vec::Vec; @@ -15,6 +15,7 @@ use std::vec::Vec; use std::ptr::read; use std::str::raw::from_c_str; +#[cfg(target_os = "macos")] pub struct c_passwd { pub pw_name: *c_char, /* user name */ pub pw_passwd: *c_char, /* user name */ @@ -28,6 +29,17 @@ pub struct c_passwd { pub pw_expire: time_t } +#[cfg(target_os = "linux")] +pub struct c_passwd { + pub pw_name: *c_char, /* user name */ + pub pw_passwd: *c_char, /* user name */ + pub pw_uid: c_int, /* user uid */ + pub pw_gid: c_int, /* user gid */ + pub pw_gecos: *c_char, + pub pw_dir: *c_char, + pub pw_shell: *c_char, +} + #[cfg(target_os = "macos")] pub struct utsname { pub sysname: [c_char, ..256],