about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTomoaki Kawada <kawada@kmckk.co.jp>2023-09-01 11:55:48 +0900
committerTomoaki Kawada <kawada@kmckk.co.jp>2023-09-01 11:55:48 +0900
commiteb627ea3392c37cd94e7696dca683ef596c8b66c (patch)
treee738c529116b64bef5161aa3255b159dbdd2a93b
parentdc37959ce858e1c3a872449cf289c9d9fa2efd2e (diff)
downloadrust-eb627ea3392c37cd94e7696dca683ef596c8b66c.tar.gz
rust-eb627ea3392c37cd94e7696dca683ef596c8b66c.zip
kmc-solid: Refactor `is_interrupted` to avoid integer overflow
-rw-r--r--library/std/src/sys/solid/net.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/library/std/src/sys/solid/net.rs b/library/std/src/sys/solid/net.rs
index bdd64ab02b7..6adced787f3 100644
--- a/library/std/src/sys/solid/net.rs
+++ b/library/std/src/sys/solid/net.rs
@@ -183,8 +183,7 @@ pub(super) fn error_name(er: abi::ER) -> Option<&'static str> {
 
 #[inline]
 pub fn is_interrupted(er: abi::ER) -> bool {
-    let errno = netc::SOLID_NET_ERR_BASE - er;
-    errno as libc::c_int == libc::EINTR
+    er == netc::SOLID_NET_ERR_BASE - libc::EINTR
 }
 
 pub(super) fn decode_error_kind(er: abi::ER) -> ErrorKind {