openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libcap/2.27-r0/libcap-2.27/libcap/cap_alloc.c
char* _libcap_strdup(const char* old)
{
    __u32* raw_data;

    if (old == NULL)
    {
        errno = EINVAL;
        return NULL;
    }

    raw_data = malloc(sizeof(__u32) + strlen(old) + 1);
    if (raw_data == NULL)
    {
        errno = ENOMEM;
        return NULL;
    }

    *(raw_data++) = CAP_S_MAGIC;
    strcpy((char*)raw_data, old);

    return ((char*)raw_data);
}
/*
 * This is an internal library function to duplicate a string and
 * tag the result as something cap_free can handle.
 */
This is an internal library function to duplicate a string and
tag the result as something cap_free can handle.
This is an internal library function to duplicate a string and tag the result as something cap_free can handle .
char* _libcap_strdup(const char* old)
{
    __u32* raw_data;
    if (old == NULL)
    {
        errno = EINVAL;
        return NULL;
    }
    raw_data = malloc(sizeof(__u32) + strlen(old) + 1);
    if (raw_data == NULL)
    {
        errno = ENOMEM;
        return NULL;
    }
    *(raw_data++) = CAP_S_MAGIC;
    strcpy((char*)raw_data, old);
    return ((char*)raw_data);
}
char * _libcap_strdup ( const char * old ) { __u32 * raw_data ; if ( old == NULL ) { errno = EINVAL ; return NULL ; } raw_data = malloc ( sizeof ( __u32 ) + strlen ( old ) + 1 ) ; if ( raw_data == NULL ) { errno = ENOMEM ; return NULL ; } * ( raw_data ++ ) = CAP_S_MAGIC ; strcpy ( ( char * ) raw_data , old ) ; return ( ( char * ) raw_data ) ; }
This is an internal library function to duplicate a string and
 tag the result as something cap_free can handle.
This is an internal library function to duplicate a string and tag the result as something cap_free can handle .