Fix predicate check in sample.
This commit is contained in:
committed by
Nikolay Igotti
parent
7b97916656
commit
76834dc7ce
@@ -18,7 +18,7 @@ import global.*
|
||||
import kotlinx.cinterop.*
|
||||
import platform.posix.*
|
||||
|
||||
fun Int.ensureUnixCallResult(op: String, predicate: (Int) -> Boolean = { x -> x >= 0} ): Int {
|
||||
fun Int.ensureUnixCallResult(op: String, predicate: (Int) -> Boolean = { x -> x == 0} ): Int {
|
||||
if (!predicate(this)) {
|
||||
throw Error("$op: ${strerror(posix_errno())!!.toKString()}")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user