diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-12-14 09:20:51 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-12-14 09:20:51 +0100 |
commit | 3352d2c605567c29840cc93a358d60881c865cb7 (patch) | |
tree | cbf3efbbb38373e9ae4c5a9b7d05e80cd90ad880 /plugins/omelasticsearch/omelasticsearch.c | |
parent | 96fbf1c3824cc87f1b68885b388102b5216b42b5 (diff) | |
download | rsyslog-3352d2c605567c29840cc93a358d60881c865cb7.tar.gz rsyslog-3352d2c605567c29840cc93a358d60881c865cb7.tar.bz2 rsyslog-3352d2c605567c29840cc93a358d60881c865cb7.zip |
minor cleanup
Diffstat (limited to 'plugins/omelasticsearch/omelasticsearch.c')
-rw-r--r-- | plugins/omelasticsearch/omelasticsearch.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/omelasticsearch/omelasticsearch.c b/plugins/omelasticsearch/omelasticsearch.c index 982f4318..499a2bb2 100644 --- a/plugins/omelasticsearch/omelasticsearch.c +++ b/plugins/omelasticsearch/omelasticsearch.c @@ -405,6 +405,8 @@ writeDataError(instanceData *pData, cJSON **pReplyRoot, uchar *reqmsg) cJSON *errRoot; cJSON *req; cJSON *replyRoot = *pReplyRoot; + size_t toWrite; + ssize_t wrRet; char errStr[1024]; DEFiRet; @@ -432,8 +434,16 @@ writeDataError(instanceData *pData, cJSON **pReplyRoot, uchar *reqmsg) cJSON_AddItemToObject(errRoot, "request", req); cJSON_AddItemToObject(errRoot, "reply", replyRoot); rendered = cJSON_Print(errRoot); -DBGPRINTF("omelasticsearch: error record: '%s'\n", rendered); - write(pData->fdErrFile, rendered, strlen(rendered)); + /* we do not do real error-handling on the err file, as this finally complicates + * things way to much. + */ + DBGPRINTF("omelasticsearch: error record: '%s'\n", rendered); + toWrite = strlen(rendered); + wrRet = write(pData->fdErrFile, rendered, toWrite); + if(wrRet != (ssize_t) toWrite) { + DBGPRINTF("omelasticsearch: error %d writing error file, write returns %lld\n", + errno, (long long) wrRet); + } free(rendered); cJSON_Delete(errRoot); *pReplyRoot = NULL; /* tell caller not to delete once again! */ |