1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 22:31:12 +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:
Ludovic Courtès 2008-09-11 00:06:55 +02:00
parent 0306509bc8
commit e9d8bc2558

View file

@ -228,9 +228,15 @@ scm_i_evict_port (void *closure, SCM 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);
if (fp->fdes == -1)