Skip to content

Commit

Permalink
utimes(2): use errno to explain the error (#931)
Browse files Browse the repository at this point in the history
  • Loading branch information
edigaryev authored Oct 31, 2024
1 parent 770220f commit c78c89e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/tart/URL+AccessDate.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Foundation
import System

extension URL {
func accessDate() throws -> Date {
Expand All @@ -13,7 +14,9 @@ extension URL {
let times = [accessDate.asTimeval(), modificationDate.asTimeval()]
let ret = utimes(path, times)
if ret != 0 {
throw RuntimeError.FailedToUpdateAccessDate("utimes(2) failed: \(ret.explanation())")
let details = Errno(rawValue: CInt(errno))

throw RuntimeError.FailedToUpdateAccessDate("utimes(2) failed: \(details)")
}
}
}
Expand Down

0 comments on commit c78c89e

Please sign in to comment.