Skip to content

Commit 7dc4434

Browse files
committed
[Data] Fix build issue with Static SDK for Linux.
Musl's definition of `S_IFMT` gets imported by the Swift importer, which means Swift can see `S_IFMT` as a `CInt` and also `S_IFMT` from the Swift overlay as a `mode_t`. The upshot is that attempting to convert it to `mode_t` produces an ambiguity error, as Swift doesn't know which definition to use.
1 parent 5164280 commit 7dc4434

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/FoundationEssentials/Data/Data+Reading.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,11 @@ internal func readBytesFromFile(path inPath: PathOrURL, reportProgress: Bool, ma
336336
}
337337

338338
let fileSize = min(Int(clamping: filestat.st_size), maxLength ?? Int.max)
339+
#if !os(Windows)
340+
let fileType = mode_t(filestat.st_mode) & S_IFMT
341+
#else
339342
let fileType = mode_t(filestat.st_mode) & mode_t(S_IFMT)
343+
#endif
340344
#if !NO_FILESYSTEM
341345
let shouldMap = shouldMapFileDescriptor(fd, path: inPath, options: options)
342346
#else

0 commit comments

Comments
 (0)