Making port-fileno support non-stream ports.

This commit is contained in:
Alex Shinn 2013-08-18 18:34:06 +09:00
parent a6e71e47b8
commit a32edf7138

6
eval.c
View file

@ -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