From bfc471e7a141068a23f91262a36c77695536c8bd Mon Sep 17 00:00:00 2001 From: Mikael Djurfeldt Date: Thu, 4 Dec 1997 16:18:59 +0000 Subject: [PATCH] * print.h (SCM_COERCE_OUTPORT): Check that the object is a pair before taking the CDR. --- libguile/ChangeLog | 3 +++ libguile/print.h | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 7ec3a69e9..61e2c79b3 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,5 +1,8 @@ 1997-12-04 Mikael Djurfeldt + * print.h (SCM_COERCE_OUTPORT): Check that the object is a pair + before taking the CDR. + * filesys.c (scm_stat): Coerce output port only if argument *is* an output port! (Thanks to Harald Meland.) diff --git a/libguile/print.h b/libguile/print.h index b686ed8bd..99de7f5e7 100644 --- a/libguile/print.h +++ b/libguile/print.h @@ -70,7 +70,9 @@ extern scm_option scm_print_opts[]; #define SCM_WRITINGP(pstate) ((pstate)->writingp) #define SCM_SET_WRITINGP(pstate, x) { (pstate)->writingp = (x); } -#define SCM_COERCE_OUTPORT(p) ((SCM_NIMP (p) && SCM_PRINT_STATE_P (SCM_CDR (p))) \ +#define SCM_COERCE_OUTPORT(p) ((SCM_NIMP (p) \ + && SCM_CONSP (p) \ + && SCM_PRINT_STATE_P (SCM_CDR (p))) \ ? SCM_CAR (p) \ : p)