natFileDescriptorPosix.cc (setLength): Handle case where ftruncate is missing.
* java/io/natFileDescriptorPosix.cc (setLength): Handle case where ftruncate is missing. * configure, include/config.h.in: Rebuilt. * acconfig.h (HAVE_FTRUNCATE): Mention. * configure.in: Check for ftruncate. From-SVN: r56658
This commit is contained in:
@@ -195,6 +195,7 @@ java::io::FileDescriptor::setLength (jlong pos)
|
||||
struct stat sb;
|
||||
off_t orig;
|
||||
|
||||
#ifdef HAVE_FTRUNCATE
|
||||
if (::fstat (fd, &sb))
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
|
||||
@@ -219,6 +220,9 @@ java::io::FileDescriptor::setLength (jlong pos)
|
||||
}
|
||||
else if (::ftruncate (fd, (off_t) pos))
|
||||
throw new IOException (JvNewStringLatin1 (strerror (errno)));
|
||||
#else /* HAVE_FTRUNCATE */
|
||||
throw new IOException (JvNewStringLatin1 ("FileDescriptor.setLength not implemented"));
|
||||
#endif /* HAVE_FTRUNCATE */
|
||||
}
|
||||
|
||||
jint
|
||||
|
||||
Reference in New Issue
Block a user