Fix predicate check in sample.

This commit is contained in:
Nikolay Igotti
2018-01-18 15:41:15 +03:00
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()}")
}