From 205410c23ade6c7321fc984af26c3d2f590dc1aa Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 15 Oct 2010 06:37:58 -0700 Subject: bugfix: a couple of problems that imfile had on some platforms namely Ubuntu (not their fault, but occured there) --- ChangeLog | 2 ++ runtime/stream.c | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b9e8fbc..7176d295 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --------------------------------------------------------------------------- Version 4.4.2a [private build] (rgerhards), 2010-10-15 +- bugfix: a couple of problems that imfile had on some platforms, namely + Ubuntu (not their fault, but occured there) - bugfix: imfile utilizes 32 bit to track offset. Most importantly, this problem can not experienced on Fedora 64 bit OS (which has 64 bit long's!) diff --git a/runtime/stream.c b/runtime/stream.c index 267e8687..9997e685 100644 --- a/runtime/stream.c +++ b/runtime/stream.c @@ -96,10 +96,12 @@ static rsRetVal strmOpenFile(strm_t *pThis) iFlags |= pThis->iAddtlOpenFlags; - pThis->fd = open((char*)pThis->pszCurrFName, iFlags, pThis->tOpenMode); + pThis->fd = open((char*)pThis->pszCurrFName, iFlags | O_LARGEFILE, pThis->tOpenMode); if(pThis->fd == -1) { int ierrnoSave = errno; - dbgoprint((obj_t*) pThis, "open error %d, file '%s'\n", errno, pThis->pszCurrFName); + char errmsg[1024]; + dbgoprint((obj_t*) pThis, "open error %d, file '%s': %s\n", errno, pThis->pszCurrFName, + rs_strerror_r(errno, errmsg, sizeof(errmsg))); if(ierrnoSave == ENOENT) ABORT_FINALIZE(RS_RET_FILE_NOT_FOUND); else @@ -522,7 +524,7 @@ rsRetVal strmFlush(strm_t *pThis) * is invalidated. * rgerhards, 2008-01-12 */ -static rsRetVal strmSeek(strm_t *pThis, off_t offs) +static rsRetVal strmSeek(strm_t *pThis, off64_t offs) { DEFiRet; @@ -532,9 +534,9 @@ static rsRetVal strmSeek(strm_t *pThis, off_t offs) strmOpenFile(pThis); else strmFlush(pThis); - int i; + int64 i; dbgoprint((obj_t*) pThis, "file %d seek, pos %ld\n", pThis->fd, (long) offs); - i = lseek(pThis->fd, offs, SEEK_SET); // TODO: check error! + i = lseek64(pThis->fd, offs, SEEK_SET); pThis->iCurrOffs = offs; /* we are now at *this* offset */ pThis->iBufPtr = 0; /* buffer invalidated */ -- cgit