summaryrefslogtreecommitdiff
path: root/dist/IO/IO.xs
diff options
context:
space:
mode:
Diffstat (limited to 'dist/IO/IO.xs')
-rw-r--r--dist/IO/IO.xs9
1 files changed, 7 insertions, 2 deletions
diff --git a/dist/IO/IO.xs b/dist/IO/IO.xs
index eed7139fde..4b13feb041 100644
--- a/dist/IO/IO.xs
+++ b/dist/IO/IO.xs
@@ -566,11 +566,10 @@ sockatmark (sock)
InputStream sock
PROTOTYPE: $
PREINIT:
- int fd;
+ int fd = PerlIO_fileno(sock);
CODE:
{
#ifdef HAS_SOCKATMARK
- int fd = PerlIO_fileno(sock);
if (fd < 0) {
errno = EBADF;
RETVAL = -1;
@@ -579,6 +578,11 @@ sockatmark (sock)
}
#else
{
+ if (fd < 0) {
+ errno = EBADF;
+ RETVAL = -1;
+ }
+ else {
int flag = 0;
# ifdef SIOCATMARK
# if defined(NETWARE) || defined(WIN32)
@@ -592,6 +596,7 @@ sockatmark (sock)
# endif
RETVAL = flag;
}
+ }
#endif
}
OUTPUT: