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/runtime/errmsg.c
static void doLogMsg(const int iErrno, const int iErrCode, const int severity,
                     const char* msg)
{
    char buf[2048];
    char errStr[1024];

    dbgprintf("Called LogMsg, msg: %s\n", msg);
    osf_write(OSF_TAG_MSG, msg);

    if (iErrno != 0)
    {
        rs_strerror_r(iErrno, errStr, sizeof(errStr));
        if (iErrCode == NO_ERRCODE || iErrCode == RS_RET_ERR)
        {
            snprintf(buf, sizeof(buf), "%s: %s [v%s]", msg, errStr, VERSION);
        }
        else
        {
            snprintf(buf, sizeof(buf),
                     "%s: %s [v%s try https://www.rsyslog.com/e/%d ]", msg,
                     errStr, VERSION, iErrCode * -1);
        }
    }
    else
    {
        if (iErrCode == NO_ERRCODE || iErrCode == RS_RET_ERR)
        {
            snprintf(buf, sizeof(buf), "%s [v%s]", msg, VERSION);
        }
        else
        {
            snprintf(buf, sizeof(buf),
                     "%s [v%s try https://www.rsyslog.com/e/%d ]", msg, VERSION,
                     iErrCode * -1);
        }
    }
    buf[sizeof(buf) - 1] = '\0'; /* just to be on the safe side... */
    errno = 0;

    const int msglen = (int)strlen(buf);
    if (msglen > glblGetMaxLine())
    {
        /* in extreme cases, our error messages may be longer than the
         * configured max message size. If so, we just truncate without further
         * indication, as anything else would probably lead to a death loop on
         * error messages. Note that we do not split, as we really do not
         * anticipate there is much value in supporting extremely short max
         * message sizes - we assume it's just a testbench thing. -- rgerhards,
         * 2018-05-11
         */
        buf[glblGetMaxLine()] = '\0'; /* space must be available! */
    }

    glblErrLogger(severity, iErrCode, (uchar*)buf);

    if (severity == LOG_ERR)
        bHadErrMsgs = 1;
}
/* We now receive three parameters: one is the internal error code
 * which will also become the error message number, the second is
 * errno - if it is non-zero, the corresponding error message is included
 * in the text and finally the message text itself. Note that it is not
 * 100% clean to use the internal errcode, as it may be reached from
 * multiple actual error causes. However, it is much better than having
 * no error code at all (and in most cases, a single internal error code
 * maps to a specific error event).
 * rgerhards, 2008-06-27
 */
We now receive three parameters: one is the internal error code
which will also become the error message number, the second is
errno - if it is non-zero, the corresponding error message is included
in the text and finally the message text itself. Note that it is not
100% clean to use the internal errcode, as it may be reached from
multiple actual error causes. However, it is much better than having
no error code at all (and in most cases, a single internal error code
maps to a specific error event).
We now receive three parameters : one is the internal error code which will also become the error message number the second is errno - if it is non - zero the corresponding error message is included in the text and finally the message text itself . Note that it is not 100% clean to use the internal errcode as it may be reached from multiple actual error causes . However it is much better than having no error code at all ( and in most cases a single internal error code maps to a specific error event ) .
static void doLogMsg(const int iErrno, const int iErrCode, const int severity,
                     const char* msg)
{
    char buf[2048];
    char errStr[1024];
    dbgprintf("Called LogMsg, msg: %s\n", msg);
    osf_write(OSF_TAG_MSG, msg);
    if (iErrno != 0)
    {
        rs_strerror_r(iErrno, errStr, sizeof(errStr));
        if (iErrCode == NO_ERRCODE || iErrCode == RS_RET_ERR)
        {
            snprintf(buf, sizeof(buf), "%s: %s [v%s]", msg, errStr, VERSION);
        }
        else
        {
            snprintf(buf, sizeof(buf),
                     "%s: %s [v%s try https://www.rsyslog.com/e/%d ]", msg,
                     errStr, VERSION, iErrCode * -1);
        }
    }
    else
    {
        if (iErrCode == NO_ERRCODE || iErrCode == RS_RET_ERR)
        {
            snprintf(buf, sizeof(buf), "%s [v%s]", msg, VERSION);
        }
        else
        {
            snprintf(buf, sizeof(buf),
                     "%s [v%s try https://www.rsyslog.com/e/%d ]", msg, VERSION,
                     iErrCode * -1);
        }
    }
    buf[sizeof(buf) - 1] = '\0'; 
    errno = 0;
    const int msglen = (int)strlen(buf);
    if (msglen > glblGetMaxLine())
    {
        buf[glblGetMaxLine()] = '\0'; 
    }
    glblErrLogger(severity, iErrCode, (uchar*)buf);
    if (severity == LOG_ERR)
        bHadErrMsgs = 1;
}
static void doLogMsg ( const int iErrno , const int iErrCode , const int severity , const char * msg ) { char buf [ 2048 ] ; char errStr [ 1024 ] ; dbgprintf ( " \n " , msg ) ; osf_write ( OSF_TAG_MSG , msg ) ; if ( iErrno != 0 ) { rs_strerror_r ( iErrno , errStr , sizeof ( errStr ) ) ; if ( iErrCode == NO_ERRCODE || iErrCode == RS_RET_ERR ) { snprintf ( buf , sizeof ( buf ) , " " , msg , errStr , VERSION ) ; } else { snprintf ( buf , sizeof ( buf ) , " " , msg , errStr , VERSION , iErrCode * -1 ) ; } } else { if ( iErrCode == NO_ERRCODE || iErrCode == RS_RET_ERR ) { snprintf ( buf , sizeof ( buf ) , " " , msg , VERSION ) ; } else { snprintf ( buf , sizeof ( buf ) , " " , msg , VERSION , iErrCode * -1 ) ; } } buf [ sizeof ( buf ) - 1 ] = ' \0 ' ; errno = 0 ; const int msglen = ( int ) strlen ( buf ) ; if ( msglen > glblGetMaxLine ( ) ) { buf [ glblGetMaxLine ( ) ] = ' \0 ' ; } glblErrLogger ( severity , iErrCode , ( uchar * ) buf ) ; if ( severity == LOG_ERR ) bHadErrMsgs = 1 ; }
We now receive three parameters: one is the internal error code
 which will also become the error message number, the second is
 errno - if it is non-zero, the corresponding error message is included
 in the text and finally the message text itself.
We now receive three parameters : one is the internal error code which will also become the error message number the second is errno - if it is non - zero the corresponding error message is included in the text and finally the message text itself .
/* just to be on the safe side... */ /* in extreme cases, our error messages may be longer than the
         * configured max message size. If so, we just truncate without further
         * indication, as anything else would probably lead to a death loop on
         * error messages. Note that we do not split, as we really do not
         * anticipate there is much value in supporting extremely short max
         * message sizes - we assume it's just a testbench thing. -- rgerhards,
         * 2018-05-11
         */ /* space must be available! */