This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Further simplify the sockatmark().
[perl5.git] / dist / IO / IO.xs
index 4b13feb..4dc9149 100644 (file)
@@ -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