From a32edf71385b395e97ce066756b3112b0504242f Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sun, 18 Aug 2013 18:34:06 +0900 Subject: [PATCH] Making port-fileno support non-stream ports. --- eval.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/eval.c b/eval.c index 219b1005..9ec882fa 100644 --- a/eval.c +++ b/eval.c @@ -1180,9 +1180,11 @@ sexp sexp_set_port_line_op (sexp ctx, sexp self, sexp_sint_t n, sexp port, sexp #ifndef PLAN9 sexp sexp_get_port_fileno (sexp ctx, sexp self, sexp_sint_t n, sexp port) { + int fd; sexp_assert_type(ctx, sexp_portp, SEXP_IPORT, port); - if (sexp_port_stream(port) && sexp_port_fileno(port) >= 0) - return sexp_make_fixnum(sexp_port_fileno(port)); + fd = sexp_port_fileno(port); + if (fd >= 0) + return sexp_make_fixnum(fd); return SEXP_FALSE; } #endif