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/tools/ompipe.c
static rsRetVal writePipe(uchar** ppString, instanceData* pData)
{
    int iLenWritten;
    DEFiRet;

    assert(pData != NULL);

    if (pData->fd == -1)
    {
        rsRetVal iRetLocal;
        iRetLocal = preparePipe(pData);
        if ((iRetLocal != RS_RET_OK) || (pData->fd == -1))
            ABORT_FINALIZE(RS_RET_SUSPENDED); /* whatever the failure was, we
                                                 need to retry */
    }

    /* create the message based on format specified */
    iLenWritten = write(pData->fd, ppString[0], strlen((char*)ppString[0]));
    if (iLenWritten < 0)
    {
        const int e = errno;
        /* If a named pipe is full, we suspend this action for a while */
        if (e == EAGAIN)
            ABORT_FINALIZE(RS_RET_SUSPENDED);

        close(pData->fd);
        pData->fd = -1; /* tell that fd is no longer open! */
        iRet = RS_RET_SUSPENDED;
        LogError(e, NO_ERRCODE, "write error on pipe %s", pData->pipe);
    }

finalize_it:
    RETiRet;
}
/* rgerhards 2004-11-11: write to a pipe output. This
 * will be called for all outputs using pipe semantics,
 * for example also for pipes.
 */
rgerhards 2004-11-11: write to a pipe output. This
will be called for all outputs using pipe semantics,
for example also for pipes.
rgerhards 2004 - 11 - 11 : write to a pipe output . This will be called for all outputs using pipe semantics for example also for pipes .
static rsRetVal writePipe(uchar** ppString, instanceData* pData)
{
    int iLenWritten;
    DEFiRet;
    assert(pData != NULL);
    if (pData->fd == -1)
    {
        rsRetVal iRetLocal;
        iRetLocal = preparePipe(pData);
        if ((iRetLocal != RS_RET_OK) || (pData->fd == -1))
            ABORT_FINALIZE(RS_RET_SUSPENDED); 
    }
    iLenWritten = write(pData->fd, ppString[0], strlen((char*)ppString[0]));
    if (iLenWritten < 0)
    {
        const int e = errno;
        if (e == EAGAIN)
            ABORT_FINALIZE(RS_RET_SUSPENDED);
        close(pData->fd);
        pData->fd = -1; 
        iRet = RS_RET_SUSPENDED;
        LogError(e, NO_ERRCODE, "write error on pipe %s", pData->pipe);
    }
finalize_it:
    RETiRet;
}
static rsRetVal writePipe ( uchar * * ppString , instanceData * pData ) { int iLenWritten ; DEFiRet ; assert ( pData != NULL ) ; if ( pData -> fd == -1 ) { rsRetVal iRetLocal ; iRetLocal = preparePipe ( pData ) ; if ( ( iRetLocal != RS_RET_OK ) || ( pData -> fd == -1 ) ) ABORT_FINALIZE ( RS_RET_SUSPENDED ) ; } iLenWritten = write ( pData -> fd , ppString [ 0 ] , strlen ( ( char * ) ppString [ 0 ] ) ) ; if ( iLenWritten < 0 ) { const int e = errno ; if ( e == EAGAIN ) ABORT_FINALIZE ( RS_RET_SUSPENDED ) ; close ( pData -> fd ) ; pData -> fd = -1 ; iRet = RS_RET_SUSPENDED ; LogError ( e , NO_ERRCODE , " " , pData -> pipe ) ; } finalize_it : RETiRet ; }
rgerhards 2004-11-11: write to a pipe output.
rgerhards 2004 - 11 - 11 : write to a pipe output .
/* whatever the failure was, we
                                                 need to retry */ /* create the message based on format specified */ /* If a named pipe is full, we suspend this action for a while */ /* tell that fd is no longer open! */