diff options
-rw-r--r-- | os2/os2.c | 1 | ||||
-rw-r--r-- | perlio.c | 10 |
2 files changed, 10 insertions, 1 deletions
@@ -22,6 +22,7 @@ #include <fcntl.h> #define PERLIO_NOT_STDIO 0 + #include "EXTERN.h" #include "perl.h" @@ -1493,12 +1493,20 @@ IV PerlIOStdio_close(PerlIO *f) { dTHX; +#ifdef HAS_SOCKET int optval, optlen = sizeof(int); +#endif FILE *stdio = PerlIOSelf(f,PerlIOStdio)->stdio; return( +#ifdef HAS_SOCKET (getsockopt(PerlIO_fileno(f), SOL_SOCKET, SO_TYPE, (char *)&optval, &optlen) < 0) ? PerlSIO_fclose(stdio) : - close(PerlIO_fileno(f))); + close(PerlIO_fileno(f)) +#else + PerlSIO_fclose(stdio) +#endif + ); + } IV |