diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-01-19 14:40:55 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-01-19 14:40:55 +0100 |
commit | b88c4885b4d2e7d6a4788c796a2f6c21eb0f43fc (patch) | |
tree | 00f466fb432952c722a42d84012861d15b938c25 /runtime | |
parent | cc08b3b0586460e4f6ce24746b8bf09f33645203 (diff) | |
parent | 452fb9282d3c53ce2a7256adfc1948b10b5b532e (diff) | |
download | rsyslog-b88c4885b4d2e7d6a4788c796a2f6c21eb0f43fc.tar.gz rsyslog-b88c4885b4d2e7d6a4788c796a2f6c21eb0f43fc.tar.xz rsyslog-b88c4885b4d2e7d6a4788c796a2f6c21eb0f43fc.zip |
Merge branch 'beta'
Conflicts:
ChangeLog
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/stream.c | 13 | ||||
-rw-r--r-- | runtime/stream.h | 3 |
2 files changed, 12 insertions, 4 deletions
diff --git a/runtime/stream.c b/runtime/stream.c index 3673db91..81f8e89b 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -209,13 +209,19 @@ doPhysOpen(strm_t *pThis) default:assert(0); break; } + if(pThis->sType == STREAMTYPE_NAMED_PIPE) { + DBGPRINTF("Note: stream '%s' is a named pipe, open with O_NONBLOCK\n", pThis->pszCurrFName); + iFlags |= O_NONBLOCK; + } pThis->fd = open((char*)pThis->pszCurrFName, iFlags, pThis->tOpenMode); DBGPRINTF("file '%s' opened as #%d with mode %d\n", pThis->pszCurrFName, pThis->fd, pThis->tOpenMode); if(pThis->fd == -1) { - int ierrnoSave = errno; - dbgoprint((obj_t*) pThis, "open error %d, file '%s'\n", errno, pThis->pszCurrFName); - if(ierrnoSave == ENOENT) + char errStr[1024]; + int err = errno; + rs_strerror_r(err, errStr, sizeof(errStr)); + dbgoprint((obj_t*) pThis, "open error %d, file '%s': %s\n", errno, pThis->pszCurrFName, errStr); + if(err == ENOENT) ABORT_FINALIZE(RS_RET_FILE_NOT_FOUND); else ABORT_FINALIZE(RS_RET_IO_ERROR); @@ -429,6 +435,7 @@ strmHandleEOF(strm_t *pThis) ISOBJ_TYPE_assert(pThis, strm); switch(pThis->sType) { case STREAMTYPE_FILE_SINGLE: + case STREAMTYPE_NAMED_PIPE: ABORT_FINALIZE(RS_RET_EOF); break; case STREAMTYPE_FILE_CIRCULAR: diff --git a/runtime/stream.h b/runtime/stream.h index 9577d704..1dc92807 100644 --- a/runtime/stream.h +++ b/runtime/stream.h @@ -76,7 +76,8 @@ typedef enum { STREAMTYPE_FILE_SINGLE = 0, /**< read a single file */ STREAMTYPE_FILE_CIRCULAR = 1, /**< circular files */ - STREAMTYPE_FILE_MONITOR = 2 /**< monitor a (third-party) file */ + STREAMTYPE_FILE_MONITOR = 2, /**< monitor a (third-party) file */ + STREAMTYPE_NAMED_PIPE = 3 /**< file is a named pipe (so far, tested for output only) */ } strmType_t; typedef enum { /* when extending, do NOT change existing modes! */ |