pass O_TRUNC to open in FileOutputStream.open

This commit is contained in:
Joel Dice
2008-06-26 15:58:14 -06:00
parent 9bea21dec7
commit 9388b6e2ce

View File

@ -257,7 +257,7 @@ Java_java_io_FileOutputStream_open(JNIEnv* e, jclass, jstring path)
{ {
const char* chars = e->GetStringUTFChars(path, 0); const char* chars = e->GetStringUTFChars(path, 0);
if (chars) { if (chars) {
int fd = doOpen(e, chars, O_WRONLY | O_CREAT); int fd = doOpen(e, chars, O_WRONLY | O_CREAT | O_TRUNC);
e->ReleaseStringUTFChars(path, chars); e->ReleaseStringUTFChars(path, chars);
return fd; return fd;
} else { } else {