Merge pull request #1936 from rgerhards/cid-185374

omtesting: flag use of rand() function as intentional (for Coverity)
This commit is contained in:
Rainer Gerhards 2017-10-30 14:24:49 +01:00 committed by GitHub
commit 77e1e6b09c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,7 @@
* NOTE: read comments in module-template.h to understand how this file
* works!
*
* Copyright 2007-2013 Rainer Gerhards and Adiscon GmbH.
* Copyright 2007-2017 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*
@ -177,6 +177,9 @@ static rsRetVal doSleep(instanceData *pData)
static rsRetVal doRandFail(void)
{
DEFiRet;
/* coverity[dc.weak_crypto] -- this is NOT used for security purposes,
* so weak PRNG is OK - rgerhards, 2017-10-30
*/
if((rand() >> 4) < (RAND_MAX >> 5)) { /* rougly same probability */
iRet = RS_RET_OK;
dbgprintf("omtesting randfail: succeeded this time\n");