summaryrefslogtreecommitdiffstats
path: root/tools/ompipe.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-04-26 18:45:12 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-04-26 18:45:12 +0200
commitdf5c3b8cddc01d122df63e20e36272af67f2ac3c (patch)
tree63a222ea5b75bae83c11b220db207d7603989023 /tools/ompipe.c
parent19c8bed08dbeb9ce0313ec92d7de85c9c51c4f48 (diff)
parent415b95cf453403f726f654cbc03ef3984446a870 (diff)
downloadrsyslog-df5c3b8cddc01d122df63e20e36272af67f2ac3c.zip
rsyslog-df5c3b8cddc01d122df63e20e36272af67f2ac3c.tar.gz
rsyslog-df5c3b8cddc01d122df63e20e36272af67f2ac3c.tar.xz
Merge branch 'v5-devel'
Conflicts: tools/omfile.c
Diffstat (limited to 'tools/ompipe.c')
-rw-r--r--tools/ompipe.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/ompipe.c b/tools/ompipe.c
index 0169536..d6b1f38 100644
--- a/tools/ompipe.c
+++ b/tools/ompipe.c
@@ -72,6 +72,7 @@ DEFobjCurrIf(errmsg)
typedef struct _instanceData {
uchar f_fname[MAXFNAME];/* pipe or template name (display only) */
short fd; /* pipe descriptor for (current) pipe */
+ sbool bHadError; /* did we already have/report an error on this pipe? */
} instanceData;
typedef struct configSettings_s {
@@ -111,6 +112,17 @@ preparePipe(instanceData *pData)
{
DEFiRet;
pData->fd = open((char*) pData->f_fname, O_RDWR|O_NONBLOCK|O_CLOEXEC);
+ if(pData->fd < 0 ) {
+ pData->fd = -1;
+ if(!pData->bHadError) {
+ char errStr[1024];
+ rs_strerror_r(errno, errStr, sizeof(errStr));
+ errmsg.LogError(0, RS_RET_NO_FILE_ACCESS, "Could no open output pipe '%s': %s",
+ pData->f_fname, errStr);
+ pData->bHadError = 1;
+ }
+ DBGPRINTF("Error opening log pipe: %s\n", pData->f_fname);
+ }
RETiRet;
}
@@ -160,6 +172,7 @@ finalize_it:
BEGINcreateInstance
CODESTARTcreateInstance
pData->fd = -1;
+ pData->bHadError = 0;
ENDcreateInstance
@@ -214,11 +227,6 @@ CODESTARTparseSelectorAct
*/
preparePipe(pData);
- if(pData->fd < 0 ) {
- pData->fd = -1;
- DBGPRINTF("Error opening log pipe: %s\n", pData->f_fname);
- errmsg.LogError(0, RS_RET_NO_FILE_ACCESS, "Could no open output pipe '%s'", pData->f_fname);
- }
CODE_STD_FINALIZERparseSelectorAct
ENDparseSelectorAct