1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-17 17:20:29 +02:00

* 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.
This commit is contained in:
Gary Houston 2000-11-13 23:16:38 +00:00
parent 9f561420d3
commit 6b72ac1d10
3 changed files with 27 additions and 8 deletions

View file

@ -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> 2000-11-12 Gary Houston <ghouston@arglist.com>
* fports.c (scm_open_file): fix the 'b' option. Thanks * fports.c (scm_open_file): fix the 'b' option. Thanks

View file

@ -48,8 +48,9 @@
#include <fcntl.h> #include <fcntl.h>
#include "libguile/_scm.h" #include "libguile/_scm.h"
#include "libguile/strings.h" #include "libguile/strings.h"
#include "libguile/validate.h" #include "libguile/validate.h"
#include "libguile/gc.h"
#include "libguile/fports.h" #include "libguile/fports.h"
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
@ -643,9 +644,7 @@ fport_flush (SCM port)
} }
pt->write_pos = pt->write_buf + remaining; pt->write_pos = pt->write_buf + remaining;
} }
if (!terminating) if (terminating)
scm_syserror ("fport_flush");
else
{ {
const char *msg = "Error: could not flush file-descriptor "; const char *msg = "Error: could not flush file-descriptor ";
char buf[11]; char buf[11];
@ -656,6 +655,14 @@ fport_flush (SCM port)
count = remaining; 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; ptr += count;
remaining -= count; remaining -= count;
@ -694,7 +701,14 @@ fport_close (SCM port)
fport_flush (port); fport_flush (port);
SCM_SYSCALL (rv = close (fp->fdes)); SCM_SYSCALL (rv = close (fp->fdes));
if (rv == -1 && errno != EBADF) if (rv == -1 && errno != EBADF)
{
if (scm_gc_running_p)
/* silently ignore the error. scm_error would abort if we
called it now. */
;
else
scm_syserror ("fport_close"); scm_syserror ("fport_close");
}
if (pt->read_buf == pt->putback_buf) if (pt->read_buf == pt->putback_buf)
pt->read_buf = pt->saved_read_buf; pt->read_buf = pt->saved_read_buf;
if (pt->read_buf != &pt->shortbuf) if (pt->read_buf != &pt->shortbuf)

View file

@ -485,9 +485,6 @@ scm_handle_by_message (void *handler_data, SCM tag, SCM args)
} }
handler_message (handler_data, tag, 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); exit (2);
} }