summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2008-09-11 00:06:55 +0200
committerLudovic Courtès <ludo@gnu.org>2008-09-11 00:06:55 +0200
commite9d8bc255881aff0906c881f4557f9acfe4ef626 (patch)
tree3717b591dbf6d026d0e2e563be5de549d10c4313
parent0306509bc89b753442b503c61310d319e37eee5b (diff)
downloadguile-e9d8bc255881aff0906c881f4557f9acfe4ef626.tar.gz
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.
-rw-r--r--libguile/fports.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libguile/fports.c b/libguile/fports.c
index bcb5a1ecf..293aa1bfc 100644
--- a/libguile/fports.c
+++ b/libguile/fports.c
@@ -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;
+
+ /* 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->fdes == fd)
+ if ((fp != NULL) && (fp->fdes == fd))
{
fp->fdes = dup (fd);
if (fp->fdes == -1)