Logo Search packages:      
Sourcecode: libnl2 version File versions  Download package

int nl_socket_set_passcred ( struct nl_sock *  sk,
int  state 
)

Enable/disable credential passing on netlink socket.

  • sk Netlink socket.
  • state New state (0 - disabled, 1 - enabled)
Returns:
0 on success or a negative error code

Definition at line 538 of file socket.c.

{
      int err;

      if (sk->s_fd == -1)
            return -NLE_BAD_SOCK;

      err = setsockopt(sk->s_fd, SOL_SOCKET, SO_PASSCRED,
                   &state, sizeof(state));
      if (err < 0)
            return -nl_syserr2nlerr(errno);

      if (state)
            sk->s_flags |= NL_SOCK_PASSCRED;
      else
            sk->s_flags &= ~NL_SOCK_PASSCRED;

      return 0;
}


Generated by  Doxygen 1.6.0   Back to index