openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libnl/1_3.4.0-r0/libnl-3.4.0/lib/socket.c
int nl_socket_drop_memberships(struct nl_sock* sk, int group, ...)
{
    int err;
    va_list ap;

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

    va_start(ap, group);

    while (group != 0)
    {
        if (group < 0)
        {
            va_end(ap);
            return -NLE_INVAL;
        }

        err = setsockopt(sk->s_fd, SOL_NETLINK, NETLINK_DROP_MEMBERSHIP, &group,
                         sizeof(group));
        if (err < 0)
        {
            va_end(ap);
            NL_DBG(4,
                   "nl_socket_drop_memberships(%p): setsockopt() failed with "
                   "%d (%s)\n",
                   sk, errno, nl_strerror_l(errno));
            return -nl_syserr2nlerr(errno);
        }

        group = va_arg(ap, int);
    }

    va_end(ap);

    return 0;
}
/**
 * Leave groups
 * @arg sk		Netlink socket
 * @arg group		Group identifier
 *
 * Leaves the specified groups using the modern socket option
 * which is available since kernel version 2.6.14. The list of groups
 * has to terminated by 0 (%NFNLGRP_NONE).
 *
 * @see nl_socket_add_membership
 * @return 0 on success or a negative error code.
 */
Leave groups
@arg sk              Netlink socket
@arg group           Group identifier

Leaves the specified groups using the modern socket option
which is available since kernel version 2.6.14. The list of groups
has to terminated by 0 (%NFNLGRP_NONE).

@see nl_socket_add_membership
@return 0 on success or a negative error code.
Leave groups @arg sk Netlink socket @arg group Group identifier Leaves the specified groups using the modern socket option which is available since kernel version 2 . 6 . 14 . The list of groups has to terminated by 0 ( %NFNLGRP_NONE ) . @see nl_socket_add_membership @return 0 on success or a negative error code .
int nl_socket_drop_memberships(struct nl_sock* sk, int group, ...)
{
    int err;
    va_list ap;
    if (sk->s_fd == -1)
        return -NLE_BAD_SOCK;
    va_start(ap, group);
    while (group != 0)
    {
        if (group < 0)
        {
            va_end(ap);
            return -NLE_INVAL;
        }
        err = setsockopt(sk->s_fd, SOL_NETLINK, NETLINK_DROP_MEMBERSHIP, &group,
                         sizeof(group));
        if (err < 0)
        {
            va_end(ap);
            NL_DBG(4,
                   "nl_socket_drop_memberships(%p): setsockopt() failed with "
                   "%d (%s)\n",
                   sk, errno, nl_strerror_l(errno));
            return -nl_syserr2nlerr(errno);
        }
        group = va_arg(ap, int);
    }
    va_end(ap);
    return 0;
}
int nl_socket_drop_memberships ( struct nl_sock * sk , int group , ... ) { int err ; va_list ap ; if ( sk -> s_fd == -1 ) return - NLE_BAD_SOCK ; va_start ( ap , group ) ; while ( group != 0 ) { if ( group < 0 ) { va_end ( ap ) ; return - NLE_INVAL ; } err = setsockopt ( sk -> s_fd , SOL_NETLINK , NETLINK_DROP_MEMBERSHIP , & group , sizeof ( group ) ) ; if ( err < 0 ) { va_end ( ap ) ; NL_DBG ( 4 , " " " \n " , sk , errno , nl_strerror_l ( errno ) ) ; return - nl_syserr2nlerr ( errno ) ; } group = va_arg ( ap , int ) ; } va_end ( ap ) ; return 0 ; }
Leave groups
 @arg sk              Netlink socket
 @arg group           Group identifier
Leave groups @arg sk Netlink socket @arg group Group identifier