mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 22:59:16 +02:00
check for a valid stream before trying to access the fileno
This commit is contained in:
parent
810e693a8c
commit
0fcba1ad3d
1 changed files with 1 additions and 1 deletions
2
sexp.c
2
sexp.c
|
@ -1646,7 +1646,7 @@ static int sexp_decode_utf8_char(const unsigned char* s) {
|
||||||
int sexp_maybe_block_port (sexp ctx, sexp in, int forcep) {
|
int sexp_maybe_block_port (sexp ctx, sexp in, int forcep) {
|
||||||
sexp f;
|
sexp f;
|
||||||
int c;
|
int c;
|
||||||
if (sexp_port_fileno(in) >= 0) {
|
if (sexp_port_stream(in) && sexp_port_fileno(in) >= 0) {
|
||||||
if (sexp_port_flags(in) == SEXP_PORT_UNKNOWN_FLAGS)
|
if (sexp_port_flags(in) == SEXP_PORT_UNKNOWN_FLAGS)
|
||||||
sexp_port_flags(in) = fcntl(sexp_port_fileno(in), F_GETFL);
|
sexp_port_flags(in) = fcntl(sexp_port_fileno(in), F_GETFL);
|
||||||
if (sexp_port_flags(in) & O_NONBLOCK) {
|
if (sexp_port_flags(in) & O_NONBLOCK) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue