Merge pull request #1980 from rgerhards/cid-185357

improve error messages in case of failing to obtain group info
This commit is contained in:
Rainer Gerhards 2017-11-07 16:06:18 +01:00 committed by GitHub
commit 5116ea13ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -837,8 +837,13 @@ doGetGID(struct nvlst *valnode, struct cnfparamdescr *param,
char stringBuf[2048]; /* 2048 has been proven to be large enough */
cstr = es_str2cstr(valnode->val.d.estr, NULL);
getgrnam_r(cstr, &wrkBuf, stringBuf, sizeof(stringBuf), &resultBuf);
const int e = getgrnam_r(cstr, &wrkBuf, stringBuf,
sizeof(stringBuf), &resultBuf);
if(resultBuf == NULL) {
if(e != 0) {
LogError(e, RS_RET_ERR, "parameter '%s': error to "
"obtaining group id for '%s'", param->name, cstr);
}
parser_errmsg("parameter '%s': ID for group %s could not "
"be found", param->name, cstr);
r = 0;