summaryrefslogtreecommitdiff
path: root/runtime/stream.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2010-11-30 15:09:49 +0100
committerMichael Biebl <biebl@debian.org>2010-11-30 15:09:49 +0100
commit0a5a3fba01d42ef3b380c4ae27699bb42c3af493 (patch)
treecba36f6ed3cf72059d16e4e702be01325c1f73c7 /runtime/stream.c
parent7e2b1add5ffd1d726801b5f3806c7e26f493c3e9 (diff)
downloadrsyslog-0a5a3fba01d42ef3b380c4ae27699bb42c3af493.tar.gz
Imported Upstream version 5.7.2upstream/5.7.2
Diffstat (limited to 'runtime/stream.c')
-rw-r--r--runtime/stream.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/runtime/stream.c b/runtime/stream.c
index b429576..260b59e 100644
--- a/runtime/stream.c
+++ b/runtime/stream.c
@@ -60,7 +60,14 @@
# include <sys/prctl.h>
#endif
-#define inline
+/* some platforms do not have large file support :( */
+#ifndef O_LARGEFILE
+# define O_LARGEFILE 0
+#endif
+#ifndef HAVE_LSEEK64
+ typedef off_t off64_t;
+# define lseek64(fd, offset, whence) lseek(fd, offset, whence)
+#endif
/* static data */
DEFobjStaticHelpers
@@ -214,7 +221,7 @@ doPhysOpen(strm_t *pThis)
iFlags |= O_NONBLOCK;
}
- pThis->fd = open((char*)pThis->pszCurrFName, iFlags, pThis->tOpenMode);
+ pThis->fd = open((char*)pThis->pszCurrFName, iFlags | O_LARGEFILE, pThis->tOpenMode);
DBGPRINTF("file '%s' opened as #%d with mode %d\n", pThis->pszCurrFName,
pThis->fd, (int) pThis->tOpenMode);
if(pThis->fd == -1) {
@@ -1184,7 +1191,7 @@ finalize_it:
* 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;
@@ -1194,9 +1201,9 @@ static rsRetVal strmSeek(strm_t *pThis, off_t offs)
strmOpenFile(pThis);
else
strmFlushInternal(pThis);
- int 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!
+ 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 */
@@ -1473,7 +1480,7 @@ static rsRetVal strmSerialize(strm_t *pThis, strm_t *pStrm)
{
DEFiRet;
int i;
- long l;
+ int64 l;
ISOBJ_TYPE_assert(pThis, strm);
ISOBJ_TYPE_assert(pStrm, strm);
@@ -1495,8 +1502,8 @@ static rsRetVal strmSerialize(strm_t *pThis, strm_t *pStrm)
i = pThis->tOpenMode;
objSerializeSCALAR_VAR(pStrm, tOpenMode, INT, i);
- l = (long) pThis->iCurrOffs;
- objSerializeSCALAR_VAR(pStrm, iCurrOffs, LONG, l);
+ l = pThis->iCurrOffs;
+ objSerializeSCALAR_VAR(pStrm, iCurrOffs, INT64, l);
CHKiRet(obj.EndSerialize(pStrm));