mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-13 07:10:20 +02:00
Fix bug in port eviction code
* libguile/fports.c (scm_i_evict_port): Check whether PORT has a ptab entry associated with it. It's unclear when this can happen.
This commit is contained in:
parent
0306509bc8
commit
e9d8bc2558
1 changed files with 8 additions and 2 deletions
|
@ -228,9 +228,15 @@ scm_i_evict_port (void *closure, SCM port)
|
||||||
|
|
||||||
if (SCM_FPORTP (port))
|
if (SCM_FPORTP (port))
|
||||||
{
|
{
|
||||||
scm_t_fport *fp = SCM_FSTREAM (port);
|
scm_t_port *p;
|
||||||
|
scm_t_fport *fp;
|
||||||
|
|
||||||
if (fp->fdes == fd)
|
/* XXX: In some cases, we can encounter a port with no associated ptab
|
||||||
|
entry. */
|
||||||
|
p = SCM_PTAB_ENTRY (port);
|
||||||
|
fp = (p != NULL) ? (scm_t_fport *) p->stream : NULL;
|
||||||
|
|
||||||
|
if ((fp != NULL) && (fp->fdes == fd))
|
||||||
{
|
{
|
||||||
fp->fdes = dup (fd);
|
fp->fdes = dup (fd);
|
||||||
if (fp->fdes == -1)
|
if (fp->fdes == -1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue