diff options
author | Andy Wingo <wingo@pobox.com> | 2016-04-05 15:13:36 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2016-04-05 15:16:26 +0200 |
commit | e8eeeeb1d4743fce89b28fa9360e71f6efd6a4e8 (patch) | |
tree | eff8fa1aa759bbb9d447fedc120160b27c944e63 /libguile/fports.c | |
parent | c0d5f8b5551cb5857f170f8e1557096874e684c5 (diff) | |
download | guile-e8eeeeb1d4743fce89b28fa9360e71f6efd6a4e8.tar.gz |
Port close functions return void
* libguile/ports.h (scm_t_ptob_descriptor): The port close function now
returns void.
(scm_set_port_close): Adapt prototype.
* libguile/ports.c (scm_close_port): Always return true if we managed to
call the close function. There's no other sensible result; exceptions
are handled, well, exceptionally.
* libguile/fports.c (fport_close)
* libguile/r6rs-ports.c (custom_binary_port_close, transcoded_port_close):
* libguile/vports.c (soft_port_close): Adapt.
* doc/ref/api-io.texi (Port Implementation): Update.
Diffstat (limited to 'libguile/fports.c')
-rw-r--r-- | libguile/fports.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/libguile/fports.c b/libguile/fports.c index e33bfe58c..963c1eafd 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -794,11 +794,10 @@ close_the_fd (void *data) errno = 0; } -static int +static void fport_close (SCM port) { scm_t_fport *fp = SCM_FSTREAM (port); - int rv; scm_dynwind_begin (0); scm_dynwind_unwind_handler (close_the_fd, fp, 0); @@ -807,15 +806,12 @@ fport_close (SCM port) scm_port_non_buffer (SCM_PTAB_ENTRY (port)); - rv = close (fp->fdes); - if (rv) + if (close (fp->fdes) != 0) /* It's not useful to retry after EINTR, as the file descriptor is in an undefined state. See http://lwn.net/Articles/365294/. Instead just throw an error if close fails, trusting that the fd was cleaned up. */ scm_syserror ("fport_close"); - - return 0; } static scm_t_bits |