- if (ret != 0) {
- #ifdef HAVE_UTIME
- if (errno == ENOSYS) {
- struct utimbuf buf;
- buf.actime = wim_timestamp_to_unix(inode->i_last_access_time);
- buf.modtime = wim_timestamp_to_unix(inode->i_last_write_time);
- if (utime(output_path, &buf) == 0)
- return 0;
- }
- #endif
- if (errno != ENOSYS || args->num_lutimes_warnings < 10) {
- /*WARNING_WITH_ERRNO("Failed to set timestamp on file `%s',*/
- /*output_path");*/
- args->num_lutimes_warnings++;
- }
+ }
+
+ if (ret == ENOSYS) {
+ /* utimensat() and lutimes() both not implemented or not
+ * available */
+ #ifdef HAVE_UTIME
+ /* Convert the WIM timestamps, which are accurate to 100
+ * nanoseconds, into a `struct utimbuf's for passing to
+ * utime(), which is accurate to 1 second. */
+ struct utimbuf buf;
+ buf.actime = wim_timestamp_to_unix(inode->i_last_access_time);
+ buf.modtime = wim_timestamp_to_unix(inode->i_last_write_time);
+ ret = utime(output_path, &buf);
+ #endif
+ }
+ if (ret && args->num_utime_warnings < 10) {
+ WARNING_WITH_ERRNO("Failed to set timestamp on file `%s'",
+ output_path);
+ args->num_utime_warnings++;