openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/rsyslog/8.1903.0-r0/rsyslog-8.1903.0/plugins/imuxsock/imuxsock.c
static void fixPID(uchar* bufTAG, int* lenTag, struct ucred* cred)
{
    int i;
    char bufPID[16];
    int lenPID;

    if (cred == NULL)
        return;

    lenPID =
        snprintf(bufPID, sizeof(bufPID), "[%lu]:", (unsigned long)cred->pid);

    for (i = *lenTag; i >= 0 && bufTAG[i] != '['; --i)
        /*JUST SKIP*/;

    if (i < 0)
        i = *lenTag -
            1; /* go right at end of TAG, pid was not present (-1 for ':') */

    if (i + lenPID > CONF_TAG_MAXSIZE)
        return; /* do not touch, as things would break */

    memcpy(bufTAG + i, bufPID, lenPID);
    *lenTag = i + lenPID;
}
/* patch correct pid into tag. bufTAG MUST be CONF_TAG_MAXSIZE long!
 */
patch correct pid into tag. bufTAG MUST be CONF_TAG_MAXSIZE long!
patch correct pid into tag . bufTAG MUST be CONF_TAG_MAXSIZE long!
static void fixPID(uchar* bufTAG, int* lenTag, struct ucred* cred)
{
    int i;
    char bufPID[16];
    int lenPID;
    if (cred == NULL)
        return;
    lenPID =
        snprintf(bufPID, sizeof(bufPID), "[%lu]:", (unsigned long)cred->pid);
    for (i = *lenTag; i >= 0 && bufTAG[i] != '['; --i)
        ;
    if (i < 0)
        i = *lenTag -
            1; 
    if (i + lenPID > CONF_TAG_MAXSIZE)
        return; 
    memcpy(bufTAG + i, bufPID, lenPID);
    *lenTag = i + lenPID;
}
static void fixPID ( uchar * bufTAG , int * lenTag , struct ucred * cred ) { int i ; char bufPID [ 16 ] ; int lenPID ; if ( cred == NULL ) return ; lenPID = snprintf ( bufPID , sizeof ( bufPID ) , " " , ( unsigned long ) cred -> pid ) ; for ( i = * lenTag ; i >= 0 && bufTAG [ i ] != ' ' ; -- i ) ; if ( i < 0 ) i = * lenTag - 1 ; if ( i + lenPID > CONF_TAG_MAXSIZE ) return ; memcpy ( bufTAG + i , bufPID , lenPID ) ; * lenTag = i + lenPID ; }
patch correct pid into tag.
patch correct pid into tag .
/*JUST SKIP*/ /* go right at end of TAG, pid was not present (-1 for ':') */ /* do not touch, as things would break */