[kaffe] Bug Report KLSEEK paramater order error in FileDescriptor.c
Cliff Wright
cliffw at messagegate.com
Wed Feb 25 09:39:02 PST 2004
Method java.io.setLength(long) will fail when increasing the size of a file.
This is due to parameters in the wrong order to KLSEEK, and a missing return check in the file libraries/clib/io/FileDescriptor.c (cvs version 1.9 latest).
The below patch fixes this.
Cliff Wright
--- libraries/clib/io/FileDescriptor.c.org Sun Dec 7 12:57:13 2003
+++ libraries/clib/io/FileDescriptor.c Thu Feb 19 22:08:31 2004
@@ -404,14 +404,14 @@
ssize_t ret;
/* Save the old file position */
- rc = KLSEEK(nativeFd, SEEK_CUR, 0, &oldPosition);
+ rc = KLSEEK(nativeFd, 0, SEEK_CUR, &oldPosition);
if (rc != 0)
{
SignalError("java.io.IOException", SYS_ERROR(rc));
}
/* Go to new_length-1 */
- rc = KLSEEK(nativeFd, SEEK_SET, new_length-1, &cur);
+ rc = KLSEEK(nativeFd, new_length-1, SEEK_SET, &cur);
if (rc != 0)
{
SignalError("java.io.IOException", SYS_ERROR(rc));
@@ -425,7 +425,8 @@
}
/* Go back to the old position */
- rc = KLSEEK(nativeFd, SEEK_SET, oldPosition, &cur);
+ rc = KLSEEK(nativeFd, oldPosition, SEEK_SET, &cur);
+ if (rc != 0)
{
SignalError("java.io.IOException", SYS_ERROR(rc));
}
More information about the kaffe
mailing list