Workaround for a sfio bug where the stream error indicator
Nicholas Clark [Mon, 16 Oct 2000 18:28:23 +0000 (19:28 +0100)]
is not cleared as documented.

Subject: PATCH (was Re: [ID 20001016.007] Not OK: perl v5.7.0 +DEVEL7228 on i586-linux 2.2.16 (UNINSTALLED))
Message-ID: <20001016182823.J19700@plum.flirble.org>

p4raw-id: //depot/perl@7353

doio.c

diff --git a/doio.c b/doio.c
index ea5ab29..2f78bc9 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -314,7 +314,13 @@ Perl_do_open9(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
                             * be optimized away on most platforms;
                             * only Solaris and Linux seem to flush
                             * on that. --jhi */
-                           PerlIO_seek(fp, 0, SEEK_CUR);
+#ifdef USE_SFIO
+                           /* sfio fails to clear error on next
+                              sfwrite, contrary to documentation.
+                              -- Nick Clark */
+                           if (PerlIO_seek(fp, 0, SEEK_CUR) == -1)
+                               PerlIO_clearerr(fp);
+#endif
                            /* On the other hand, do all platforms
                             * take gracefully to flushing a read-only
                             * filehandle?  Perhaps we should do