This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Build fixes for Win32 after the Coverity smoke.
authorJarkko Hietaniemi <jhi@iki.fi>
Thu, 29 May 2014 20:56:28 +0000 (16:56 -0400)
committerJarkko Hietaniemi <jhi@iki.fi>
Thu, 29 May 2014 21:17:27 +0000 (17:17 -0400)
(for 375ed12a42c6092b1af1d8e395bf3dadd9a66e48)

dist/IO/IO.xs
dist/threads/threads.xs

index eed7139..4b13feb 100644 (file)
@@ -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:
index 182cd37..6175ba7 100644 (file)
@@ -714,10 +714,12 @@ S_ithread_create(
     PERL_SET_CONTEXT(aTHX);
     if (!thread) {
         MUTEX_UNLOCK(&MY_POOL.create_destruct_mutex);
-        int fd = PerlIO_fileno(Perl_error_log);
-        if (fd >= 0) {
-          /* If there's no error_log, we cannot scream about it missing. */
-          PERL_UNUSED_RESULT(PerlLIO_write(fd, PL_no_mem, strlen(PL_no_mem)));
+        {
+          int fd = PerlIO_fileno(Perl_error_log);
+          if (fd >= 0) {
+            /* If there's no error_log, we cannot scream about it missing. */
+            PERL_UNUSED_RESULT(PerlLIO_write(fd, PL_no_mem, strlen(PL_no_mem)));
+          }
         }
         my_exit(1);
     }