Skip to content

Commit 9a06b52

Browse files
finagolfinhyp
authored andcommitted
[android] the new Android overlay gets the S_IFMT definition directly from the Bionic header
1 parent 69cfa27 commit 9a06b52

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Sources/Foundation/FileManager+POSIX.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ extension FileManager {
650650

651651
#if !os(WASI) // WASI doesn't have ownership concept
652652
// Set the file permissions using fchmod() instead of when open()ing to avoid umask() issues
653-
let permissions = fileInfo.st_mode & ~S_IFMT
653+
let permissions = fileInfo.st_mode & ~mode_t(S_IFMT)
654654
guard fchmod(dstfd, permissions) == 0 else {
655655
throw _NSErrorWithErrno(errno, reading: false, path: dstPath,
656656
extraUserInfo: extraErrorInfo(srcPath: srcPath, dstPath: dstPath, userVariant: variant))

Sources/Foundation/FileManager.swift

+2
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,8 @@ open class FileManager : NSObject {
886886
return Int(mode & ~UInt32(ucrt.S_IFMT))
887887
#elseif canImport(Darwin)
888888
return Int(mode & ~UInt32(S_IFMT))
889+
#elseif canImport(Android)
890+
return Int(mode & ~mode_t(S_IFMT))
889891
#else
890892
return Int(mode & ~S_IFMT)
891893
#endif

0 commit comments

Comments
 (0)