Fix memory leak.
[openssl.git] / crypto / bio / bss_sock.c
index 76d1387527da2ac3259f457c99e8b7b8733424bb..3df31938c185510fdf008d245388b7589b70ef13 100644 (file)
  * [including the GNU Public Licence.]
  */
 
-#ifndef NO_SOCK
-
 #include <stdio.h>
 #include <errno.h>
 #define USE_SOCKETS
 #include "cryptlib.h"
+
+#ifndef OPENSSL_NO_SOCK
+
 #include <openssl/bio.h>
 
+#ifdef WATT32
+#define sock_write SockWrite  /* Watt-32 uses same names */
+#define sock_read  SockRead
+#define sock_puts  SockPuts
+#endif
+
 static int sock_write(BIO *h, const char *buf, int num);
 static int sock_read(BIO *h, char *buf, int size);
 static int sock_puts(BIO *h, const char *str);
@@ -165,15 +172,6 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr)
 
        switch (cmd)
                {
-       case BIO_CTRL_RESET:
-               num=0;
-       case BIO_C_FILE_SEEK:
-               ret=0;
-               break;
-       case BIO_C_FILE_TELL:
-       case BIO_CTRL_INFO:
-               ret=0;
-               break;
        case BIO_C_SET_FD:
                sock_free(b);
                b->num= *((int *)ptr);
@@ -196,10 +194,6 @@ static long sock_ctrl(BIO *b, int cmd, long num, void *ptr)
        case BIO_CTRL_SET_CLOSE:
                b->shutdown=(int)num;
                break;
-       case BIO_CTRL_PENDING:
-       case BIO_CTRL_WPENDING:
-               ret=0;
-               break;
        case BIO_CTRL_DUP:
        case BIO_CTRL_FLUSH:
                ret=1;
@@ -228,7 +222,7 @@ int BIO_sock_should_retry(int i)
                {
                err=get_last_socket_error();
 
-#if defined(WINDOWS) && 0 /* more microsoft stupidity? perhaps not? Ben 4/1/99 */
+#if defined(OPENSSL_SYS_WINDOWS) && 0 /* more microsoft stupidity? perhaps not? Ben 4/1/99 */
                if ((i == -1) && (err == 0))
                        return(1);
 #endif
@@ -242,7 +236,7 @@ int BIO_sock_non_fatal_error(int err)
        {
        switch (err)
                {
-#if defined(WINDOWS)
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_NETWARE)
 # if defined(WSAEWOULDBLOCK)
        case WSAEWOULDBLOCK:
 # endif
@@ -273,7 +267,7 @@ int BIO_sock_non_fatal_error(int err)
 #endif
 
 #ifdef EAGAIN
-#if EWOULDBLOCK != EAGAIN
+# if EWOULDBLOCK != EAGAIN
        case EAGAIN:
 # endif
 #endif
@@ -296,4 +290,5 @@ int BIO_sock_non_fatal_error(int err)
                }
        return(0);
        }
-#endif
+
+#endif  /* #ifndef OPENSSL_NO_SOCK */