Casey Marshall wrote:
> Our usage of `readdir' wasn't portable: on Darwin, you get a NULL return
> value, but `errno' will be zero. We were expecting errno to be nonzero
> in that case.
> 
> This had the side effect that we'd keep reallocating the filename array,
> because we'd be looping on the same value for `filename', and this would
> exhaust memory.
> 
> I also took the liberty of adding a check for readdir_r, and use it in
> cpio_readDir if it is available.
> 
> 2006-09-22  Casey Marshall  <[EMAIL PROTECTED]>
> 
>       * configure.ac (AC_CHECK_FUNCS): check for `readdir_r.'
>       * native/jni/java-io/java_io_VMFile.c (Java_java_io_VMFile_list):
>       allocate `filename,' and handle changes to `cpio_readDir.'
>       * native/jni/native-lib/cpio.c (cpio_readDir): use `readdir_r' if
>       available; copy the filename into the destination buffer; return
>       an error code if readdir returns NULL, but errno is 0.
>       * native/jni/native-lib/cpio.h (cpio_readDir): change second
>       parameter to `const char *.'
> 

Yup, this code introduced warnings. Fixed with this:

2006-09-22  Casey Marshall  <[EMAIL PROTECTED]>

        * native/jni/java-io/java_io_VMFile.c
        (Java_java_io_VMFile_list): remove `const' from `filename.'
        * native/jni/native-lib/cpio.c (cpio_readDir): remove `const'
        from `filename.'
        * native/jni/native-lib/cpio.h (cpio_readDir): likewise.


Reply via email to