diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-03-20 12:47:53 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-03-20 12:47:53 +0100 |
commit | 2b69e2aaddb587185b7c0ddb412b36549d848091 (patch) | |
tree | 5dbd4a989970a986c21e21403f9328fb59c8afd2 /plugins/omstdout/omstdout.c | |
parent | b2e6b9c1f5d9ab22b42def8b2448d1da47ac87c1 (diff) | |
download | rsyslog-2b69e2aaddb587185b7c0ddb412b36549d848091.tar.gz rsyslog-2b69e2aaddb587185b7c0ddb412b36549d848091.tar.bz2 rsyslog-2b69e2aaddb587185b7c0ddb412b36549d848091.zip |
omstdout: added debug message when writing to stdout fails
Diffstat (limited to 'plugins/omstdout/omstdout.c')
-rw-r--r-- | plugins/omstdout/omstdout.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/omstdout/omstdout.c b/plugins/omstdout/omstdout.c index 59f9c8bb..a84a7593 100644 --- a/plugins/omstdout/omstdout.c +++ b/plugins/omstdout/omstdout.c @@ -105,6 +105,7 @@ BEGINdoAction int iBuf; char szBuf[65564]; size_t len; + int r; CODESTARTdoAction if(pData->bUseArrayInterface) { /* if we use array passing, we need to put together a string @@ -140,9 +141,15 @@ CODESTARTdoAction * actually intends to use this module in production (why???), this code * needs to be more solid. -- rgerhards, 2012-11-28 */ - if(write(1, toWrite, len)) {}; /* 1 is stdout! */ + if((r = write(1, toWrite, len)) != (int) len) { /* 1 is stdout! */ + DBGPRINTF("omstdout: error %d writing to stdout[%d]: %s\n", + r, len, toWrite); + } if(pData->bEnsureLFEnding && toWrite[len-1] != '\n') { - if(write(1, "\n", 1)) {}; /* write missing LF */ + if((r = write(1, "\n", 1)) != 1) { /* write missing LF */ + DBGPRINTF("omstdout: error %d writing \\n to stdout\n", + r); + } } ENDdoAction |