This takes the simplest course for removing the use of readdir_r. In the long run, we may want to change more of this and use glib as opposed to using readdir directly.
ChangeLog:
2008-02-22 Andrew John Hughes <[EMAIL PROTECTED]>
PR classpath/33751:
* configure.ac:
Don't check for readdir_r.
* native/jni/native-lib/cpio.c:
(cpio_readDir): Remove use of readdir_r, zero errno
before starting and always leave a \0 at the end after
strncpy.
* vm/reference/java/io/VMFile.java:
(list(String)): Make synchronized.
--
Andrew :)
Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8
Index: configure.ac
===================================================================
RCS file: /sources/classpath/classpath/configure.ac,v
retrieving revision 1.223
diff -u -3 -p -u -r1.223 configure.ac
--- configure.ac 12 Feb 2008 22:30:21 -0000 1.223
+++ configure.ac 22 Feb 2008 03:01:21 -0000
@@ -401,7 +401,7 @@ if test "x${COMPILE_JNI}" = xyes; then
lstat readlink \
inet_aton inet_addr inet_pton \
getifaddrs kqueue kevent epoll_create \
- readdir_r getloadavg])
+ getloadavg])
LIBMAGIC=
AC_CHECK_LIB(magic, magic_open, LIBMAGIC=-lmagic)
Index: native/jni/native-lib/cpio.c
===================================================================
RCS file: /sources/classpath/classpath/native/jni/native-lib/cpio.c,v
retrieving revision 1.11
diff -u -3 -p -u -r1.11 cpio.c
--- native/jni/native-lib/cpio.c 28 Dec 2007 17:49:56 -0000 1.11
+++ native/jni/native-lib/cpio.c 22 Feb 2008 03:01:23 -0000
@@ -564,16 +564,10 @@ int cpio_closeDir (void *handle)
int cpio_readDir (void *handle, char *filename)
{
-#ifdef HAVE_READDIR_R
- struct dirent dent;
-#endif /* HAVE_READDIR_R */
struct dirent *dBuf;
-#ifdef HAVE_READDIR_R
- readdir_r ((DIR *) handle, &dent, &dBuf);
-#else
+ errno = 0;
dBuf = readdir((DIR *)handle);
-#endif /* HAVE_READDIR_R */
if (dBuf == NULL)
{
@@ -584,7 +578,7 @@ int cpio_readDir (void *handle, char *fi
return errno;
}
- strncpy (filename, dBuf->d_name, FILENAME_MAX);
+ strncpy (filename, dBuf->d_name, FILENAME_MAX - 1);
return 0;
}
Index: vm/reference/java/io/VMFile.java
===================================================================
RCS file: /sources/classpath/classpath/vm/reference/java/io/VMFile.java,v
retrieving revision 1.11
diff -u -3 -p -u -r1.11 VMFile.java
--- vm/reference/java/io/VMFile.java 6 Nov 2007 13:38:42 -0000 1.11
+++ vm/reference/java/io/VMFile.java 22 Feb 2008 03:01:23 -0000
@@ -80,10 +80,10 @@ final class VMFile
static native boolean create(String path) throws IOException;
/*
- * This native function actually produces the list of file in this
+ * This native function actually produces the list of files in this
* directory
*/
- static native String[] list(String dirpath);
+ static native synchronized String[] list(String dirpath);
/*
* This native method actually performs the rename.
signature.asc
Description: Digital signature
