diff options
author | Yaroslav Kuzmin <ykuzmin@rocketsoftware.com> | 2014-09-28 10:02:17 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2014-10-21 09:26:49 -0600 |
commit | ea5bc90f605c42b5ba11bf0aa5b9df6e7d9ec3e7 (patch) | |
tree | 8afbb799fafac2520fabcc991ee98a638232395f /perlio.c | |
parent | 8a65147e419322d7c5ae5680e93886a7deb8b7c3 (diff) | |
download | perl-ea5bc90f605c42b5ba11bf0aa5b9df6e7d9ec3e7.tar.gz |
perlio: Fix to work with MVS Dataset
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -2930,11 +2930,27 @@ PerlIO_importFILE(FILE *stdio, const char *mode) { dTHX; PerlIO *f = NULL; +#ifdef EBCDIC + int rc; + char filename[FILENAME_MAX]; + fldata_t fileinfo; +#endif if (stdio) { PerlIOStdio *s; int fd0 = fileno(stdio); if (fd0 < 0) { +#ifdef EBCDIC + rc = fldata(stdio,filename,&fileinfo); + if(rc != 0){ + return NULL; + } + if(fileinfo.__dsorgHFS){ + return NULL; + } + /*This MVS dataset , OK!*/ +#else return NULL; +#endif } if (!mode || !*mode) { /* We need to probe to see how we can open the stream @@ -2966,7 +2982,24 @@ PerlIO_importFILE(FILE *stdio, const char *mode) if ((f = PerlIO_push(aTHX_(PerlIO_allocate(aTHX)), PERLIO_FUNCS_CAST(&PerlIO_stdio), mode, NULL))) { s = PerlIOSelf(f, PerlIOStdio); s->stdio = stdio; +#ifdef EBCDIC + fd0 = fileno(stdio); + if(fd0 != -1){ + PerlIOUnix_refcnt_inc(fd0); + } + else{ + rc = fldata(stdio,filename,&fileinfo); + if(rc != 0){ + PerlIOUnix_refcnt_inc(fd0); + } + if(fileinfo.__dsorgHFS){ + PerlIOUnix_refcnt_inc(fd0); + } + /*This MVS dataset , OK!*/ + } +#else PerlIOUnix_refcnt_inc(fileno(stdio)); +#endif } } return f; |