diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-05-26 21:45:41 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-05-26 21:45:41 -0700 |
commit | 5c2ef0f30737544588b3bb916e31a00cbca245c4 (patch) | |
tree | d0ce445422ce87c321a68dfbae761f637128af6a /stream.c | |
parent | a006a4cf197c8fea8fa54a94847319343c94e609 (diff) | |
download | txr-5c2ef0f30737544588b3bb916e31a00cbca245c4.tar.gz txr-5c2ef0f30737544588b3bb916e31a00cbca245c4.tar.bz2 txr-5c2ef0f30737544588b3bb916e31a00cbca245c4.zip |
streams: avoid double access to errno.
* stream.c (stdio_maybe_read_error): Access errno once, and
refer to the value.
Diffstat (limited to 'stream.c')
-rw-r--r-- | stream.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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"), |