This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
rt.perl.org #123977 - clear errno in IRIX PERLIO=stdio
authorJarkko Hietaniemi <jhi@iki.fi>
Sat, 17 Oct 2015 22:11:37 +0000 (18:11 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 18 Oct 2015 02:16:25 +0000 (22:16 -0400)
Under some circumstances IRIX stdio fgetc() and fread() set the errno
to ENOENT, which makes no sense according to either IRIX or POSIX docs.
Just clear such an errno.

perlio.c

index ae8cbc9..8ab47e4 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -3332,6 +3332,12 @@ PerlIOStdio_read(pTHX_ PerlIO *f, void *vbuf, Size_t count)
            return -1;
        SETERRNO(0,0);  /* just in case */
     }
+#ifdef __sgi
+    /* Under some circumstances IRIX stdio fgetc() and fread()
+     * set the errno to ENOENT, which makes no sense according
+     * to either IRIX or POSIX.  [rt.perl.org #123977] */
+    if (errno == ENOENT) SETERRNO(0,0);
+#endif
     return got;
 }