int log_errno_fill_property()

in v2/src/log_errno_win32.c [18:44]


int log_errno_fill_property(void* buffer, int dummy)
{
    (void)dummy;

    if (buffer == NULL)
    {
        /* Codes_SRS_LOG_ERRNO_WIN32_01_002: [ If buffer is NULL, log_errno_fill_property shall return 512 to indicate how many bytes shall be reserved for the string formatted errno. ] */
        // do nothing
    }
    else
    {
        /* Codes_SRS_LOG_ERRNO_WIN32_01_003: [ Otherwise, log_errno_fill_property shall obtain the errno value. ] */
        /* Codes_SRS_LOG_ERRNO_WIN32_01_004: [ log_errno_fill_property shall call strerror_s with buffer, 512 and the errno value. ] */
        if (strerror_s(buffer, MESSAGE_BUFFER_SIZE, errno) != 0)
        {
            /* Codes_SRS_LOG_ERRNO_WIN32_01_005: [ If strerror_s fails, log_errno_fill_property shall copy in buffer the string failure in strerror_s and return 512. ] */
            (void)memcpy(buffer, strerror_s_failure_message, sizeof(strerror_s_failure_message));
        }
        else
        {
            // return
        }
    }

    /* Codes_SRS_LOG_ERRNO_WIN32_01_007: [ log_errno_fill_property shall return 512. ] */
    return MESSAGE_BUFFER_SIZE;
}