diff options
-rw-r--r-- | libguile/ChangeLog | 8 | ||||
-rw-r--r-- | libguile/fports.c | 24 | ||||
-rw-r--r-- | libguile/throw.c | 3 |
3 files changed, 27 insertions, 8 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 03f7fb717..b284072c1 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,11 @@ +2000-11-13 Gary Houston <ghouston@arglist.com> + + * fports.c: include gc.h. + (fport_flush, fport_close): silently ignore I/O errors when + closing a port during gc. it's better than aborting in scm_error. + + * throw.c (scm_handle_by_message): remove obsolete comment. + 2000-11-12 Gary Houston <ghouston@arglist.com> * fports.c (scm_open_file): fix the 'b' option. Thanks diff --git a/libguile/fports.c b/libguile/fports.c index a14130b40..9438bbd0d 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -48,8 +48,9 @@ #include <fcntl.h> #include "libguile/_scm.h" #include "libguile/strings.h" - #include "libguile/validate.h" +#include "libguile/gc.h" + #include "libguile/fports.h" #ifdef HAVE_STRING_H @@ -643,9 +644,7 @@ fport_flush (SCM port) } pt->write_pos = pt->write_buf + remaining; } - if (!terminating) - scm_syserror ("fport_flush"); - else + if (terminating) { const char *msg = "Error: could not flush file-descriptor "; char buf[11]; @@ -656,6 +655,14 @@ fport_flush (SCM port) count = remaining; } + else if (scm_gc_running_p) + { + /* silently ignore the error. scm_error would abort if we + called it now. */ + count = remaining; + } + else + scm_syserror ("fport_flush"); } ptr += count; remaining -= count; @@ -694,7 +701,14 @@ fport_close (SCM port) fport_flush (port); SCM_SYSCALL (rv = close (fp->fdes)); if (rv == -1 && errno != EBADF) - scm_syserror ("fport_close"); + { + if (scm_gc_running_p) + /* silently ignore the error. scm_error would abort if we + called it now. */ + ; + else + scm_syserror ("fport_close"); + } if (pt->read_buf == pt->putback_buf) pt->read_buf = pt->saved_read_buf; if (pt->read_buf != &pt->shortbuf) diff --git a/libguile/throw.c b/libguile/throw.c index afa9ffaec..dfcb4c44d 100644 --- a/libguile/throw.c +++ b/libguile/throw.c @@ -485,9 +485,6 @@ scm_handle_by_message (void *handler_data, SCM tag, SCM args) } handler_message (handler_data, tag, args); - /* try to flush the error message first before the rest of the - ports: if any throw error, it currently causes a bus - exception. */ exit (2); } |