From: Nick Ing-Simmons Date: Sat, 20 Oct 2001 12:51:05 +0000 (+0000) Subject: Fix for ithreads/stdio build X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e0fa5af24242618e2201252ebce12dfc87892dd1;p=p5sagit%2Fp5-mst-13.2.git Fix for ithreads/stdio build p4raw-id: //depot/perlio@12529 --- diff --git a/perlio.c b/perlio.c index dd9f394..963601a 100644 --- 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 */ diff --git a/perlsdio.h b/perlsdio.h index a1d2bec..d09b632 100644 --- a/perlsdio.h +++ b/perlsdio.h @@ -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