Skip to content

Commit f275b2c

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. rdar://147201087
1 parent 320c583 commit f275b2c

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
@@ -334,7 +334,11 @@ internal func readBytesFromFile(path inPath: PathOrURL, reportProgress: Bool, ma
334334
}
335335

336336
let fileSize = min(Int(clamping: filestat.st_size), maxLength ?? Int.max)
337+
#if !os(Windows)
338+
let fileType = mode_t(filestat.st_mode) & S_IFMT
339+
#else
337340
let fileType = mode_t(filestat.st_mode) & mode_t(S_IFMT)
341+
#endif
338342
#if !NO_FILESYSTEM
339343
let shouldMap = shouldMapFileDescriptor(fd, path: inPath, options: options)
340344
#else

0 commit comments

Comments
 (0)