Commit 9ade2d08 authored by Olivier Bertrand's avatar Olivier Bertrand

- FIX ftell error when the line endings do not match the declared or

  default ending. Also takes care of files having mixed line endings.
  This is done by never using text mode for streams and handle the line
  endings in reading and writing. (MDEV-7030)
modified:
  storage/connect/filamtxt.cpp
parent f3e7e50d
...@@ -537,7 +537,8 @@ bool DOSFAM::OpenTableFile(PGLOBAL g) ...@@ -537,7 +537,8 @@ bool DOSFAM::OpenTableFile(PGLOBAL g)
PDBUSER dbuserp = PlgGetUser(g); PDBUSER dbuserp = PlgGetUser(g);
// This is required when using Unix files under Windows and vice versa // This is required when using Unix files under Windows and vice versa
Bin = (Blocked || Ending != CRLF); //Bin = (Blocked || Ending != CRLF);
Bin = true; // To void ftell problems
switch (mode) { switch (mode) {
case MODE_READ: case MODE_READ:
...@@ -683,7 +684,7 @@ bool DOSFAM::RecordPos(PGLOBAL g) ...@@ -683,7 +684,7 @@ bool DOSFAM::RecordPos(PGLOBAL g)
{ {
if ((Fpos = ftell(Stream)) < 0) { if ((Fpos = ftell(Stream)) < 0) {
sprintf(g->Message, MSG(FTELL_ERROR), 0, strerror(errno)); sprintf(g->Message, MSG(FTELL_ERROR), 0, strerror(errno));
strcat(g->Message, " (possible wrong ENDING option value)"); // strcat(g->Message, " (possible wrong ENDING option value)");
return true; return true;
} // endif Fpos } // endif Fpos
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment