Very good point.
Is the following a safe sequence IRT proper errno
handling?
@inline(never)
func readBytes(buffer: UnsafeMutableRawBufferPointer) throws -> Int {
let size = Darwin.read(file, buffer.baseAddress, buffer.count)
// *****************
guard size >= 0 else {
throw SomeError.errno(errno)
}
return size
}
or is it possible there would some ARC code that could change errno
in the marked line between Darwin call and errno
reading?
(Just in case I've marked it as inline(never)
, not sure if that's necessary).