mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
only reify a fileno from an integer if the fileno is still open
This commit is contained in:
parent
d0510bebe6
commit
ade90906f9
1 changed files with 5 additions and 2 deletions
5
sexp.c
5
sexp.c
|
@ -1838,8 +1838,11 @@ static sexp* sexp_fileno_cell(sexp ctx, sexp vec, int fd) {
|
|||
static sexp sexp_lookup_fileno(sexp ctx, int fd) {
|
||||
sexp* cell = sexp_fileno_cell(ctx, sexp_global(ctx, SEXP_G_FILE_DESCRIPTORS), fd);
|
||||
if (cell && sexp_ephemeronp(*cell)
|
||||
&& sexp_fileno_fd(sexp_ephemeron_key(*cell)) == fd)
|
||||
&& sexp_filenop(sexp_ephemeron_key(*cell))
|
||||
&& sexp_fileno_fd(sexp_ephemeron_key(*cell)) == fd) {
|
||||
if (sexp_fileno_openp(sexp_ephemeron_key(*cell)))
|
||||
return sexp_ephemeron_key(*cell);
|
||||
}
|
||||
return SEXP_FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue