From 52781e59e0b15141d06ec0b8524d096606551b93 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Wed, 12 Oct 2011 22:54:11 +0900 Subject: [PATCH] Using ferror when possible in sexp_maybe_block_port. --- sexp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sexp.c b/sexp.c index 179b4f39..cd6e7dc3 100644 --- a/sexp.c +++ b/sexp.c @@ -1986,7 +1986,11 @@ int sexp_maybe_block_port (sexp ctx, sexp in, int forcep) { if (sexp_port_flags(in) & O_NONBLOCK) { if (!forcep && (((c = sexp_read_char(ctx, in)) == EOF) +#if SEXP_USE_STRING_STREAMS + && (ferror(sexp_port_stream(in)) == EAGAIN) +#else && (errno == EAGAIN) +#endif && sexp_opcodep((f=sexp_global(ctx, SEXP_G_THREADS_BLOCKER))))) { ((sexp_proc2)sexp_opcode_func(f))(ctx sexp_api_pass(f, 1), in); return 1;