Skip to content
This repository has been archived by the owner on May 15, 2018. It is now read-only.

Commit

Permalink
Use struct ucred from libc crate instead of our own.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kixunil committed Jun 15, 2017
1 parent 7270717 commit e0da3a9
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/ucred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@ pub use self::impl_linux::get_peer_cred;

#[cfg(target_os = "linux")]
pub mod impl_linux {
use libc::{pid_t, uid_t, gid_t, getsockopt, SOL_SOCKET, SO_PEERCRED, c_void};
use libc::{getsockopt, SOL_SOCKET, SO_PEERCRED, c_void};
use std::{io, mem};
use UnixStream;
use std::os::unix::io::AsRawFd;

#[repr(C)]
struct UCred {
pid: pid_t,
uid: uid_t,
gid: gid_t,
}
use libc::ucred as UCred;

pub fn get_peer_cred(sock: &UnixStream) -> io::Result<super::UCred> {
unsafe {
Expand Down

0 comments on commit e0da3a9

Please sign in to comment.