From 32e4572f5dd85f69111ccebb1f6069137e1c660c Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Fri, 22 Feb 2008 03:06:03 +0000 Subject: 2008-02-22 Andrew John Hughes 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. --- native/jni/native-lib/cpio.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'native') diff --git a/native/jni/native-lib/cpio.c b/native/jni/native-lib/cpio.c index 0ef97f185..d8523680a 100644 --- a/native/jni/native-lib/cpio.c +++ b/native/jni/native-lib/cpio.c @@ -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 *filename) return errno; } - strncpy (filename, dBuf->d_name, FILENAME_MAX); + strncpy (filename, dBuf->d_name, FILENAME_MAX - 1); return 0; } -- cgit v1.2.1