[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Thu Feb 11 14:34:25 UTC 2016


The branch master has been updated
       via  27f172d9a3f3ec9901439b4823c95788598fa367 (commit)
      from  143e5e50f22eaff58e90dd20bdb66eae6ab3b53e (commit)


- Log -----------------------------------------------------------------
commit 27f172d9a3f3ec9901439b4823c95788598fa367
Author: Rich Salz <rsalz at openssl.org>
Date:   Thu Feb 11 09:33:51 2016 -0500

    GH620: second diff from rt-2275, adds error code
    
    clean up and apply patches from RT-2275
    
    Signed-off-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 crypto/bio/b_sock.c   | 32 ++++++++++++++++++++++++++++++++
 include/openssl/err.h |  1 +
 2 files changed, 33 insertions(+)

diff --git a/crypto/bio/b_sock.c b/crypto/bio/b_sock.c
index 3e17bec..4ae08d2 100644
--- a/crypto/bio/b_sock.c
+++ b/crypto/bio/b_sock.c
@@ -379,8 +379,40 @@ int BIO_socket_nbio(int s, int mode)
 
     l = mode;
 # ifdef FIONBIO
+    l = mode;
+
     ret = BIO_socket_ioctl(s, FIONBIO, &l);
+# elif defined(F_GETFL) && defined(F_SETFL) && (defined(O_NONBLOCK) || defined(FNDELAY))
+    /* make sure this call always pushes an error level; BIO_socket_ioctl() does so, so we do too. */
+
+    l = fcntl(s, F_GETFL, 0);
+    if (l == -1) {
+        SYSerr(SYS_F_FCNTL, get_last_rtl_error());
+        ret = -1;
+    } else {
+#  if defined(O_NONBLOCK)
+        l &= ~O_NONBLOCK;
+#  else
+        l &= ~FNDELAY; /* BSD4.x */
+#  endif
+        if (mode) {
+#  if defined(O_NONBLOCK)
+            l |= O_NONBLOCK;
+#  else
+            l |= FNDELAY; /* BSD4.x */
+#  endif
+        }
+        ret = fcntl(s, F_SETFL, l);
+
+        if (ret < 0) {
+            SYSerr(SYS_F_FCNTL, get_last_rtl_error());
+        }
+    }
+# else
+    /* make sure this call always pushes an error level; BIO_socket_ioctl() does so, so we do too. */
+    BIOerr(BIO_F_BIO_SOCKET_NBIO, ERR_R_PASSED_INVALID_ARGUMENT);
 # endif
+
     return (ret == 0);
 }
 
diff --git a/include/openssl/err.h b/include/openssl/err.h
index bdf8308..390ee74 100644
--- a/include/openssl/err.h
+++ b/include/openssl/err.h
@@ -310,6 +310,7 @@ typedef struct err_state_st {
 # define ERR_R_INTERNAL_ERROR                    (4|ERR_R_FATAL)
 # define ERR_R_DISABLED                          (5|ERR_R_FATAL)
 # define ERR_R_INIT_FAIL                         (6|ERR_R_FATAL)
+# define ERR_R_PASSED_INVALID_ARGUMENT           (7) 
 
 /*
  * 99 is the maximum possible ERR_R_... code, higher values are reserved for


More information about the openssl-commits mailing list