diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2012-08-25 01:39:00 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-08-26 13:09:22 -0700 |
commit | 642c83f5327317780a0f10b3ab46f6c1bd8bb202 (patch) | |
tree | 25da068eb33918cf786b87f9afb74e1a0dec5db6 /parse-xml.c | |
parent | 415383d65ef425de8ddee86324632e3f720827f9 (diff) | |
download | subsurface-642c83f5327317780a0f10b3ab46f6c1bd8bb202.tar.gz |
file.c: open a file in binary mode in readfile()
O_TEXT is the default mode for fctrl's open() and on windows created
files, line endings are counted by fstat() as CR+LF adding an extra
byte for each line. the result from this is that, while the file still
can be read into a buffer, the read() return (ret) has a different
size compared to the previously allocated buffer, breaking at:
if (ret == mem->size)
a solution is to open() the file in O_BINARY mode, which should
technically suppress the EOL translation.
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
[ Fixed to work under real operating systems that don't need this crap.
"Here's a nickel, kid, go and buy a real OS". - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'parse-xml.c')
0 files changed, 0 insertions, 0 deletions