Module Name:    src
Committed By:   riastradh
Date:           Wed Mar 29 10:18:50 UTC 2023

Modified Files:
        src/crypto/external/bsd/openssl/dist/apps: s_client.c s_server.c

Log Message:
openssl: Revert local patch around fileno(stdin/stdout).

According to the commit history, this was introduced when gcc4.5
complained about using the return value of fileno without checking it
against -1.  gcc 10.4 no longer appears to object, so let's just nix
the local patch.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 \
    src/crypto/external/bsd/openssl/dist/apps/s_client.c \
    src/crypto/external/bsd/openssl/dist/apps/s_server.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/openssl/dist/apps/s_client.c
diff -u src/crypto/external/bsd/openssl/dist/apps/s_client.c:1.25 src/crypto/external/bsd/openssl/dist/apps/s_client.c:1.26
--- src/crypto/external/bsd/openssl/dist/apps/s_client.c:1.25	Tue Mar 15 20:51:12 2022
+++ src/crypto/external/bsd/openssl/dist/apps/s_client.c	Wed Mar 29 10:18:50 2023
@@ -2770,16 +2770,6 @@ int s_client_main(int argc, char **argv)
     for (;;) {
         FD_ZERO(&readfds);
         FD_ZERO(&writefds);
-        int fdin = fileno_stdin();
-        if (fdin < 0) {
-            BIO_printf(bio_err,"bad fileno for stdin\n");
-            goto shut;
-        }
-        int fdout = fileno_stdout();
-        if (fdout < 0) {
-            BIO_printf(bio_err,"bad fileno for stdout\n");
-            goto shut;
-        }
 
         if (SSL_is_dtls(con) && DTLSv1_get_timeout(con, &timeout))
             timeoutp = &timeout;
@@ -2834,10 +2824,10 @@ int s_client_main(int argc, char **argv)
                  * set the flag so we exit.
                  */
                 if (read_tty && !at_eof)
-                    openssl_fdset(fdin, &readfds);
+                    openssl_fdset(fileno_stdin(), &readfds);
 #if !defined(OPENSSL_SYS_VMS)
                 if (write_tty)
-                    openssl_fdset(fdout, &writefds);
+                    openssl_fdset(fileno_stdout(), &writefds);
 #endif
             }
             if (read_ssl)
@@ -2965,7 +2955,7 @@ int s_client_main(int argc, char **argv)
         /* Assume Windows/DOS/BeOS can always write */
         else if (!ssl_pending && write_tty)
 #else
-        else if (!ssl_pending && FD_ISSET(fdout, &writefds))
+        else if (!ssl_pending && FD_ISSET(fileno_stdout(), &writefds))
 #endif
         {
 #ifdef CHARSET_EBCDIC
@@ -3052,7 +3042,7 @@ int s_client_main(int argc, char **argv)
 #if defined(OPENSSL_SYS_MSDOS)
         else if (has_stdin_waiting())
 #else
-        else if (FD_ISSET(fdin, &readfds))
+        else if (FD_ISSET(fileno_stdin(), &readfds))
 #endif
         {
             if (crlf) {
Index: src/crypto/external/bsd/openssl/dist/apps/s_server.c
diff -u src/crypto/external/bsd/openssl/dist/apps/s_server.c:1.25 src/crypto/external/bsd/openssl/dist/apps/s_server.c:1.26
--- src/crypto/external/bsd/openssl/dist/apps/s_server.c:1.25	Tue Feb  7 22:25:29 2023
+++ src/crypto/external/bsd/openssl/dist/apps/s_server.c	Wed Mar 29 10:18:50 2023
@@ -2265,7 +2265,7 @@ static int sv_body(int s, int stype, int
     char *buf = NULL;
     fd_set readfds;
     int ret = 1, width;
-    int k, i, fdin;
+    int k, i;
     unsigned long l;
     SSL *con = NULL;
     BIO *sbio;
@@ -2449,14 +2449,9 @@ static int sv_body(int s, int stype, int
                            || (async && SSL_waiting_for_async(con));
 
         if (!read_from_sslcon) {
-            fdin = fileno_stdin();
-            if (fdin < 0) {
-                BIO_printf(bio_err,"Bad fileno for stdin\n");
-                goto err;
-            }
             FD_ZERO(&readfds);
 #if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS)
-            openssl_fdset(fdin, &readfds);
+            openssl_fdset(fileno_stdin(), &readfds);
 #endif
             openssl_fdset(s, &readfds);
             /*
@@ -2493,7 +2488,7 @@ static int sv_body(int s, int stype, int
 
             if (i <= 0)
                 continue;
-            if (FD_ISSET(fdin, &readfds))
+            if (FD_ISSET(fileno_stdin(), &readfds))
                 read_from_terminal = 1;
 #endif
             if (FD_ISSET(s, &readfds))

Reply via email to