summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--os2/os2.c1
-rw-r--r--perlio.c10
2 files changed, 10 insertions, 1 deletions
diff --git a/os2/os2.c b/os2/os2.c
index 6faa415ffb..66e48c42e3 100644
--- a/os2/os2.c
+++ b/os2/os2.c
@@ -22,6 +22,7 @@
#include <fcntl.h>
#define PERLIO_NOT_STDIO 0
+
#include "EXTERN.h"
#include "perl.h"
diff --git a/perlio.c b/perlio.c
index b0517e394f..41d4a8ed98 100644
--- a/perlio.c
+++ b/perlio.c
@@ -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