@@ -204,7 +204,7 @@ typedef int openat_func(int, const char *, int, ...);
204204typedef int fstatat_func (int , const char * , struct stat * , int );
205205typedef int unlinkat_func (int , const char * , int );
206206typedef int renameat_func (int , const char * , int , const char * );
207- typedef int futimesat_func (int , const char * , const struct timeval * );
207+ typedef int futimes_func (int , const struct timeval * );
208208typedef int futimens_func (int , const struct timespec * );
209209typedef int lutimes_func (const char * , const struct timeval * );
210210typedef DIR * fdopendir_func (int );
@@ -217,7 +217,7 @@ static openat_func* my_openat_func = NULL;
217217static fstatat_func * my_fstatat_func = NULL ;
218218static unlinkat_func * my_unlinkat_func = NULL ;
219219static renameat_func * my_renameat_func = NULL ;
220- static futimesat_func * my_futimesat_func = NULL ;
220+ static futimes_func * my_futimes_func = NULL ;
221221static futimens_func * my_futimens_func = NULL ;
222222static lutimes_func * my_lutimes_func = NULL ;
223223static fdopendir_func * my_fdopendir_func = NULL ;
@@ -363,8 +363,8 @@ Java_sun_nio_fs_UnixNativeDispatcher_init(JNIEnv* env, jclass this)
363363 /* system calls that might not be available at run time */
364364
365365#if defined(_ALLBSD_SOURCE )
366- my_openat_func = (openat_func * )dlsym ( RTLD_DEFAULT , " openat" ) ;
367- my_fstatat_func = (fstatat_func * )dlsym ( RTLD_DEFAULT , " fstatat" ) ;
366+ my_openat_func = (openat_func * ) openat ;
367+ my_fstatat_func = (fstatat_func * ) fstatat ;
368368#else
369369 // Make sure we link to the 64-bit version of the functions
370370 my_openat_func = (openat_func * ) dlsym (RTLD_DEFAULT , "openat64" );
@@ -373,22 +373,22 @@ Java_sun_nio_fs_UnixNativeDispatcher_init(JNIEnv* env, jclass this)
373373 my_unlinkat_func = (unlinkat_func * ) dlsym (RTLD_DEFAULT , "unlinkat" );
374374 my_renameat_func = (renameat_func * ) dlsym (RTLD_DEFAULT , "renameat" );
375375#if defined(__linux__ ) && defined(__arm__ )
376- my_futimesat_func = (futimesat_func * ) lookup_time_t_function ("futimesat " ,
377- "__futimesat64 " );
376+ my_futimes_func = (futimes_func * ) lookup_time_t_function ("futimes " ,
377+ "__futimes64 " );
378378 my_lutimes_func = (lutimes_func * ) lookup_time_t_function ("lutimes" ,
379379 "__lutimes64" );
380380 my_futimens_func = (futimens_func * ) lookup_time_t_function ("futimens" ,
381381 "__futimens64" );
382382#else
383- #ifndef _ALLBSD_SOURCE
384- my_futimesat_func = (futimesat_func * ) dlsym (RTLD_DEFAULT , "futimesat" );
383+ my_futimes_func = (futimes_func * ) dlsym (RTLD_DEFAULT , "futimes" );
385384 my_lutimes_func = (lutimes_func * ) dlsym (RTLD_DEFAULT , "lutimes" );
386- #endif
387385 my_futimens_func = (futimens_func * ) dlsym (RTLD_DEFAULT , "futimens" );
388386#endif
389387#if defined(_AIX )
390388 // Make sure we link to the 64-bit version of the function
391389 my_fdopendir_func = (fdopendir_func * ) dlsym (RTLD_DEFAULT , "fdopendir64" );
390+ #elif defined(_ALLBSD_SOURCE )
391+ my_fdopendir_func = (fdopendir_func * ) fdopendir ;
392392#else
393393 my_fdopendir_func = (fdopendir_func * ) dlsym (RTLD_DEFAULT , "fdopendir" );
394394#endif
@@ -399,13 +399,13 @@ Java_sun_nio_fs_UnixNativeDispatcher_init(JNIEnv* env, jclass this)
399399 my_fstatat_func = (fstatat_func * )& fstatat_wrapper ;
400400#endif
401401
402- /* supports futimes or futimesat , futimens, and/or lutimes */
402+ /* supports futimes, futimens, and/or lutimes */
403403
404404#ifdef _ALLBSD_SOURCE
405405 capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_FUTIMES ;
406406 capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_LUTIMES ;
407407#else
408- if (my_futimesat_func != NULL )
408+ if (my_futimes_func != NULL )
409409 capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_FUTIMES ;
410410 if (my_lutimes_func != NULL )
411411 capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_LUTIMES ;
@@ -417,7 +417,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_init(JNIEnv* env, jclass this)
417417
418418 if (my_openat_func != NULL && my_fstatat_func != NULL &&
419419 my_unlinkat_func != NULL && my_renameat_func != NULL &&
420- my_futimesat_func != NULL && my_fdopendir_func != NULL )
420+ my_futimes_func != NULL && my_fdopendir_func != NULL )
421421 {
422422 capabilities |= sun_nio_fs_UnixNativeDispatcher_SUPPORTS_OPENAT ;
423423 }
@@ -914,11 +914,11 @@ Java_sun_nio_fs_UnixNativeDispatcher_futimes0(JNIEnv* env, jclass this, jint fil
914914#ifdef _ALLBSD_SOURCE
915915 RESTARTABLE (futimes (filedes , & times [0 ]), err );
916916#else
917- if (my_futimesat_func == NULL ) {
918- JNU_ThrowInternalError (env , "my_futimesat_func is NULL" );
917+ if (my_futimes_func == NULL ) {
918+ JNU_ThrowInternalError (env , "my_futimes_func is NULL" );
919919 return ;
920920 }
921- RESTARTABLE ((* my_futimesat_func )(filedes , NULL , & times [0 ]), err );
921+ RESTARTABLE ((* my_futimes_func )(filedes , & times [0 ]), err );
922922#endif
923923 if (err == -1 ) {
924924 throwUnixException (env , errno );
0 commit comments