From cd5253fa82fdbd7529f76c9cec2130e1ccb210bb Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 7 Oct 2011 11:42:49 +0200 Subject: bugfix: imfile did invalid system call under some circumstances when a file that was to be monitored did not exist BUT the state file actually existed. Mostly a cosmetic issue. Root cause was incomplete error checking in stream.c; so patch may affect other code areas. --- runtime/stream.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'runtime/stream.c') diff --git a/runtime/stream.c b/runtime/stream.c index ae716815..0238d25e 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -1276,16 +1276,18 @@ static rsRetVal strmSeek(strm_t *pThis, off64_t offs) ISOBJ_TYPE_assert(pThis, strm); - if(pThis->fd == -1) - strmOpenFile(pThis); - else - strmFlushInternal(pThis); + if(pThis->fd == -1) { + CHKiRet(strmOpenFile(pThis)); + } else { + CHKiRet(strmFlushInternal(pThis)); + } long long i; DBGOPRINT((obj_t*) pThis, "file %d seek, pos %llu\n", pThis->fd, (long long unsigned) offs); i = lseek64(pThis->fd, offs, SEEK_SET); // TODO: check error! pThis->iCurrOffs = offs; /* we are now at *this* offset */ pThis->iBufPtr = 0; /* buffer invalidated */ +finalize_it: RETiRet; } -- cgit v1.2.3