From 5c2ef0f30737544588b3bb916e31a00cbca245c4 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 26 May 2022 21:45:41 -0700 Subject: streams: avoid double access to errno. * stream.c (stdio_maybe_read_error): Access errno once, and refer to the value. --- stream.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'stream.c') diff --git a/stream.c b/stream.c index fb0dae68..6fcf73c5 100644 --- a/stream.c +++ b/stream.c @@ -593,10 +593,11 @@ static val stdio_maybe_read_error(val stream) if (h->f == 0) uw_throwf(file_error_s, lit("error reading ~s: file closed"), stream, nao); if (ferror(h->f)) { - val err = num(errno); + int eno = errno; + val err = num(eno); h->err = err; #ifdef EAGAIN - if (errno == EAGAIN) + if (eno == EAGAIN) uw_ethrowf(timeout_error_s, lit("timed out reading ~s"), stream, nao); #endif uw_ethrowf(file_error_s, lit("error reading ~s: ~d/~s"), -- cgit v1.2.3