mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-20 14:19:18 +02:00
Hopefully the last fd gc issue: also preserve for newly opening FILE* ports
if the corresponding fd still exists in the cache.
This commit is contained in:
parent
7d663dd316
commit
c5179f2271
1 changed files with 9 additions and 0 deletions
9
sexp.c
9
sexp.c
|
@ -1752,6 +1752,15 @@ sexp sexp_make_input_port (sexp ctx, FILE* in, sexp name) {
|
||||||
sexp_port_blockedp(p) = 0;
|
sexp_port_blockedp(p) = 0;
|
||||||
#if SEXP_USE_FOLD_CASE_SYMS
|
#if SEXP_USE_FOLD_CASE_SYMS
|
||||||
sexp_port_fold_casep(p) = sexp_truep(sexp_global(ctx, SEXP_G_FOLD_CASE_P));
|
sexp_port_fold_casep(p) = sexp_truep(sexp_global(ctx, SEXP_G_FOLD_CASE_P));
|
||||||
|
#endif
|
||||||
|
#if SEXP_USE_WEAK_REFERENCES
|
||||||
|
/* if the fd was previously opened by a non-stream port, preserve it */
|
||||||
|
/* here to avoid gc timing issues */
|
||||||
|
if (in && fileno(in) >= 0) {
|
||||||
|
sexp_port_fd(p) = sexp_lookup_fileno(ctx, fileno(in));
|
||||||
|
if (sexp_filenop(sexp_port_fd(p)))
|
||||||
|
sexp_fileno_openp(sexp_port_fd(p)) = 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
sexp_port_cookie(p) = SEXP_VOID;
|
sexp_port_cookie(p) = SEXP_VOID;
|
||||||
return p;
|
return p;
|
||||||
|
|
Loading…
Add table
Reference in a new issue