There's a little bug in java_io_FileOutputStream.cpp/
Java_java_io_FileOutputStream.open():
because O_WRONLY flag isn't specified, there's problem
when we want to write in data.
java.io.FileOutputStream has two constructor:
FileOutputStream(File f) and
FileOutputStream(String name, boolean append);
Most of time we call the former one, so this bug
escapes our test cases.
Also, because O_TRUNC flag isn't set, we will fail in
truncating the content when append is false.
Recommended modification as the following:
#ifdef ORP_NT
// Rope in _O_BINARY so that Ctrl-Z will not
be interpreted as an EOF indicator,
// and translations are suppressed. Is it
okay to have this ALWAYS ??? BUG?????
fmode |= _O_BINARY;
#endif
fmode |= O_WRONLY;
if (append)
fmode |= O_APPEND;
else
fmode |= O_TRUNC;