|
From: <gb...@us...> - 2008-06-24 12:38:59
|
Revision: 208
http://gearbox.svn.sourceforge.net/gearbox/?rev=208&view=rev
Author: gbiggs
Date: 2008-06-24 05:25:19 -0700 (Tue, 24 Jun 2008)
Log Message:
-----------
Altered internal behaviour when reaching the end of the write file
Modified Paths:
--------------
gearbox/trunk/submitted/flexiport/logfile.cpp
Modified: gearbox/trunk/submitted/flexiport/logfile.cpp
===================================================================
--- gearbox/trunk/submitted/flexiport/logfile.cpp 2008-06-24 12:19:11 UTC (rev 207)
+++ gearbox/trunk/submitted/flexiport/logfile.cpp 2008-06-24 12:25:19 UTC (rev 208)
@@ -712,18 +712,26 @@
// One final thing to do: it's possible that the write file has reached its end and so been
// closed. This means that any attempts to read the response to the write will now fail. To
// prevent this, reopen the files and re-position the read file's offset to where it was. Any
- // writes after this would have choked anyway since the file is at an end so having the write
- // file at the beginning is unlikely to cause any problems.
+ // writes after this would have choked anyway since the file is at an end so moving the write
+ // file to 1 byte before the end is unlikely to cause any problems, while still registering as
+ // an open file.
if (!IsOpen ())
{
Open (_fileName, _read, _ignoreTimes);
if (fseek (_readFile, readFileOffset, SEEK_SET) < 0)
{
stringstream ss;
- ss << "LogFile::" << __func__ << "() fseek() error: (" << ErrNo () << ") " <<
+ ss << "LogFile::" << __func__ << "() fseek(_readFile) error: (" << ErrNo () << ") " <<
StrError (ErrNo ());
throw PortException (ss.str ());
}
+ if (fseek (_writeFile, -1, SEEK_END) < 0)
+ {
+ stringstream ss;
+ ss << "LogFile::" << __func__ << "() fseek(_writeFile) error: (" << ErrNo () << ") " <<
+ StrError (ErrNo ());
+ throw PortException (ss.str ());
+ }
}
delete[] fileData;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|