@@ -1021,13 +1021,7 @@ public void utimensat(int dirFd, Object pathname, long[] timespec, boolean follo
1021
1021
@ Shared ("invoke" ) @ Cached InvokeNativeFunction invokeNode ) throws PosixException {
1022
1022
assert PosixConstants .HAVE_UTIMENSAT .value ;
1023
1023
assert timespec == null || timespec .length == 4 ;
1024
- Object timespecArg ;
1025
- if (timespec == null ) {
1026
- timespecArg = PNone .NO_VALUE ;
1027
- } else {
1028
- timespecArg = timespec ;
1029
- }
1030
- int ret = invokeNode .callInt (this , PosixNativeFunction .call_utimensat , dirFd , pathToCString (pathname ), timespecArg , followSymlinks ? 1 : 0 );
1024
+ int ret = invokeNode .callInt (this , PosixNativeFunction .call_utimensat , dirFd , pathToCString (pathname ), wrap (timespec ), followSymlinks ? 1 : 0 );
1031
1025
if (ret != 0 ) {
1032
1026
throw newPosixException (invokeNode , getErrno (invokeNode ));
1033
1027
}
@@ -1038,7 +1032,7 @@ public void futimens(int fd, long[] timespec,
1038
1032
@ Shared ("invoke" ) @ Cached InvokeNativeFunction invokeNode ) throws PosixException {
1039
1033
assert PosixConstants .HAVE_FUTIMENS .value ;
1040
1034
assert timespec == null || timespec .length == 4 ;
1041
- int ret = invokeNode .callInt (this , PosixNativeFunction .call_futimens , fd , timespec );
1035
+ int ret = invokeNode .callInt (this , PosixNativeFunction .call_futimens , fd , wrap ( timespec ) );
1042
1036
if (ret != 0 ) {
1043
1037
throw newPosixException (invokeNode , getErrno (invokeNode ));
1044
1038
}
@@ -2672,6 +2666,14 @@ private PosixException newPosixException(InvokeNativeFunction invokeNode, int er
2672
2666
throw new PosixException (errno , strerror (errno , invokeNode , TruffleString .FromByteArrayNode .getUncached (), TruffleString .SwitchEncodingNode .getUncached ()));
2673
2667
}
2674
2668
2669
+ private Object wrap (long [] value ) {
2670
+ if (value == null ) {
2671
+ return PNone .NO_VALUE ;
2672
+ } else {
2673
+ return value ;
2674
+ }
2675
+ }
2676
+
2675
2677
private Object wrap (Timeval [] timeval ) {
2676
2678
if (timeval == null ) {
2677
2679
return PNone .NO_VALUE ;
0 commit comments