| 1347 | |
| 1348 | #ifdef HAVE_UTIMENSAT |
| 1349 | int do_utimensat(const char *path, STRUCT_STAT *stp) |
| 1350 | { |
| 1351 | struct timespec t[2]; |
| 1352 | |
| 1353 | if (dry_run) return 0; |
| 1354 | RETURN_ERROR_IF_RO_OR_LO; |
| 1355 | |
| 1356 | t[0].tv_sec = stp->st_atime; |
| 1357 | #ifdef ST_ATIME_NSEC |
| 1358 | t[0].tv_nsec = stp->ST_ATIME_NSEC; |
| 1359 | #else |
| 1360 | t[0].tv_nsec = 0; |
| 1361 | #endif |
| 1362 | t[1].tv_sec = stp->st_mtime; |
| 1363 | #ifdef ST_MTIME_NSEC |
| 1364 | t[1].tv_nsec = stp->ST_MTIME_NSEC; |
| 1365 | #else |
| 1366 | t[1].tv_nsec = 0; |
| 1367 | #endif |
| 1368 | return utimensat(AT_FDCWD, path, t, AT_SYMLINK_NOFOLLOW); |
| 1369 | } |
| 1370 | |
| 1371 | /* |
| 1372 | Symlink-race-safe variant of do_utimensat() for receiver-side use. |