|
1 | | -From 7e0817f4c7dbc748fc70c45c20edd5acc98a34d7 |
2 | | -From: Yuta Saito <kateinoigakukun@gmail.com> |
3 | | -Date: Tue, 17 Dec 2024 04:19:39 +0900 |
4 | | -Subject: [PATCH] Follow-up fixes to make it work with wasi-libc (#1095) |
5 | | - |
6 | | -* Use `futimens` instead of legacy `futimes` |
7 | | - |
8 | | -wasi-libc does not provide `futimes` as it is a legacy function. |
9 | | -https://github.com/WebAssembly/wasi-libc/blob/574b88da481569b65a237cb80daf9a2d5aeaf82d/libc-top-half/musl/include/sys/time.h#L34 |
10 | | - |
11 | | -diff --git a/swift-foundation/Sources/FoundationEssentials/FileManager/FileOperations.swift b/swift-foundation/Sources/FoundationEssentials/FileManager/FileOperations.swift |
12 | | -index ce4de44a..96ee566d 100644 |
13 | | ---- a/swift-foundation/Sources/FoundationEssentials/FileManager/FileOperations.swift |
14 | | -+++ b/swift-foundation/Sources/FoundationEssentials/FileManager/FileOperations.swift |
15 | | -@@ -944,11 +944,11 @@ enum _FileOperations { |
16 | | - } |
17 | | - |
18 | | - // Copy modification date |
19 | | -- let value = timeval(tv_sec: statInfo.st_mtim.tv_sec, tv_usec: statInfo.st_mtim.tv_nsec / 1000) |
20 | | -+ let value = statInfo.st_mtim |
21 | | - var tv = (value, value) |
22 | | - try withUnsafePointer(to: &tv) { |
23 | | -- try $0.withMemoryRebound(to: timeval.self, capacity: 2) { |
24 | | -- if futimes(dstFD, $0) != 0 { |
25 | | -+ try $0.withMemoryRebound(to: timespec.self, capacity: 2) { |
26 | | -+ if futimens(dstFD, $0) != 0 { |
27 | | - try delegate.throwIfNecessary(errno, srcPath(), dstPath()) |
28 | | - } |
29 | | - } |
30 | 1 | commit 4339393f2c1f3bceaf20bc2c25ee828a2e0394aa |
31 | 2 | Author: Alex Lorenz <arphaman@gmail.com> |
32 | 3 | Date: Thu Dec 12 07:34:34 2024 -0800 |
|
0 commit comments