This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix for ithreads/stdio build
authorNick Ing-Simmons <nik@tiuk.ti.com>
Sat, 20 Oct 2001 12:51:05 +0000 (12:51 +0000)
committerNick Ing-Simmons <nik@tiuk.ti.com>
Sat, 20 Oct 2001 12:51:05 +0000 (12:51 +0000)
p4raw-id: //depot/perlio@12529

perlio.c
perlsdio.h

index dd9f394..963601a 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -128,6 +128,24 @@ PerlIO_binmode(pTHX_ PerlIO *fp, int iotype, int mode, const char *names)
 #endif
 }
 
+PerlIO *
+PerlIO_fdupopen(pTHX_ PerlIO *f, CLONE_PARAMS *param)
+{
+    if (f) {
+       int fd = PerlLIO_dup(PerlIO_fileno(f));
+       if (fd >= 0) {
+           /* the r+ is a hack */
+           return PerlIO_fdopen(fd, "r+");
+       }
+       return NULL;
+    }
+    else {
+       SETERRNO(EBADF, SS$_IVCHAN);
+    }
+    return NULL;
+}
+
+
 /*
  * De-mux PerlIO_openn() into fdopen, freopen and fopen type entries
  */
index a1d2bec..d09b632 100644 (file)
@@ -13,7 +13,6 @@
 #define PerlIO_stdout()                        stdout
 #define PerlIO_stdin()                 stdin
 
-#define PerlIO_fdupopen(f)             (f)
 #define PerlIO_isutf8(f)               0
 
 #define PerlIO_printf                  fprintf