Mercurial > hg > xemacs-beta
diff src/lstream.c @ 8:4b173ad71786 r19-15b5
Import from CVS: tag r19-15b5
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:47:35 +0200 |
parents | ac2d302a0011 |
children | 0293115a14e9 |
line wrap: on
line diff
--- a/src/lstream.c Mon Aug 13 08:47:16 2007 +0200 +++ b/src/lstream.c Mon Aug 13 08:47:35 2007 +0200 @@ -685,6 +685,8 @@ static int Lstream_pseudo_close (Lstream *lstr) { + int rc; + if (!lstr->flags & LSTREAM_FL_IS_OPEN) { Lisp_Object obj = Qnil; @@ -694,18 +696,20 @@ } /* don't check errors here -- best not to risk file descriptor loss */ - Lstream_flush (lstr); + rc = Lstream_flush (lstr); - return 0; + return rc; } int Lstream_close (Lstream *lstr) { + int rc = 0; + if (lstr->flags & LSTREAM_FL_IS_OPEN) { /* don't return here on error, or file descriptor leak will result. */ - Lstream_pseudo_close (lstr); + rc = Lstream_pseudo_close (lstr); if (lstr->imp->closer) { if ((lstr->imp->closer) (lstr) < 0) @@ -738,7 +742,7 @@ lstr->unget_buffer = 0; } - return 0; + return rc; } int