diff --git a/library/crypto-rand/src/linuxAndroidMain/kotlin/org/kotlincrypto/random/internal/URandom.kt b/library/crypto-rand/src/linuxAndroidMain/kotlin/org/kotlincrypto/random/internal/URandom.kt index 607cfda..9d0488a 100644 --- a/library/crypto-rand/src/linuxAndroidMain/kotlin/org/kotlincrypto/random/internal/URandom.kt +++ b/library/crypto-rand/src/linuxAndroidMain/kotlin/org/kotlincrypto/random/internal/URandom.kt @@ -33,7 +33,11 @@ private inline fun openRDONLY(path: String, block: (fd: Int) -> T): T callsInPlace(block, InvocationKind.AT_MOST_ONCE) } - val fd = open(path, O_RDONLY or O_CLOEXEC, null) + @Suppress("VariableInitializerIsRedundant") + var fd = -1 + do { + fd = open(path, O_RDONLY or O_CLOEXEC, 0) + } while (fd == -1 && errno == EINTR) if (fd == -1) throw errnoToRandomnessProcurementException(errno) try {