summaryrefslogtreecommitdiff
path: root/dist/IO/IO.xs
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-05-29 17:36:41 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-05-29 17:37:35 -0400
commit9ae155c4bb0d2592306c583640e0b6f0e6273a7d (patch)
treec20b5227bf3d5446479ce09a296887ae725a3cf5 /dist/IO/IO.xs
parentfa9804ae636b8a12f77d0e537f628658d44ea189 (diff)
downloadperl-9ae155c4bb0d2592306c583640e0b6f0e6273a7d.tar.gz
Further simplify the sockatmark().
(And do not assign the fd in PREINIT.)
Diffstat (limited to 'dist/IO/IO.xs')
-rw-r--r--dist/IO/IO.xs16
1 files changed, 5 insertions, 11 deletions
diff --git a/dist/IO/IO.xs b/dist/IO/IO.xs
index 4b13feb041..4dc9149983 100644
--- a/dist/IO/IO.xs
+++ b/dist/IO/IO.xs
@@ -566,22 +566,18 @@ sockatmark (sock)
InputStream sock
PROTOTYPE: $
PREINIT:
- int fd = PerlIO_fileno(sock);
+ int fd;
CODE:
- {
-#ifdef HAS_SOCKATMARK
+ fd = PerlIO_fileno(sock);
if (fd < 0) {
errno = EBADF;
RETVAL = -1;
- } else {
+ }
+#ifdef HAS_SOCKATMARK
+ else {
RETVAL = sockatmark(fd);
}
#else
- {
- if (fd < 0) {
- errno = EBADF;
- RETVAL = -1;
- }
else {
int flag = 0;
# ifdef SIOCATMARK
@@ -596,9 +592,7 @@ sockatmark (sock)
# endif
RETVAL = flag;
}
- }
#endif
- }
OUTPUT:
RETVAL