Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/external/bsd/openssl remove gcc-4.5 hacks; gcc-4.5 do...
details: https://anonhg.NetBSD.org/src/rev/4ac49bcbdd3b
branches: trunk
changeset: 768448:4ac49bcbdd3b
user: christos <christos%NetBSD.org@localhost>
date: Wed Aug 17 05:30:01 2011 +0000
description:
remove gcc-4.5 hacks; gcc-4.5 does not like fileno() to be unchecked, and
produces an unhelpful out of bounds array warning, so check it.
diffstat:
crypto/external/bsd/openssl/bin/Makefile | 10 +-------
crypto/external/bsd/openssl/dist/apps/s_client.c | 27 +++++++++++++++++------
crypto/external/bsd/openssl/dist/apps/s_server.c | 20 +++++++++++------
3 files changed, 35 insertions(+), 22 deletions(-)
diffs (168 lines):
diff -r 3c1832117c4b -r 4ac49bcbdd3b crypto/external/bsd/openssl/bin/Makefile
--- a/crypto/external/bsd/openssl/bin/Makefile Wed Aug 17 00:59:47 2011 +0000
+++ b/crypto/external/bsd/openssl/bin/Makefile Wed Aug 17 05:30:01 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2011/06/22 02:49:42 mrg Exp $
+# $NetBSD: Makefile,v 1.5 2011/08/17 05:30:01 christos Exp $
WARNS?= 2 # XXX -Wcast-qual
@@ -10,7 +10,7 @@
USE_FORT?= yes # cryptographic software
# RCSid:
-# $Id: Makefile,v 1.4 2011/06/22 02:49:42 mrg Exp $
+# $Id: Makefile,v 1.5 2011/08/17 05:30:01 christos Exp $
#
# @(#) Copyright (c) 1995 Simon J. Gerraty
#
@@ -112,9 +112,3 @@
.endif
.include <bsd.prog.mk>
-
-# XXX
-.if ${HAVE_GCC} == 45
-COPTS.s_server.c+= -Wno-error
-COPTS.s_client.c+= -Wno-error
-.endif
diff -r 3c1832117c4b -r 4ac49bcbdd3b crypto/external/bsd/openssl/dist/apps/s_client.c
--- a/crypto/external/bsd/openssl/dist/apps/s_client.c Wed Aug 17 00:59:47 2011 +0000
+++ b/crypto/external/bsd/openssl/dist/apps/s_client.c Wed Aug 17 05:30:01 2011 +0000
@@ -510,6 +510,7 @@
int cbuf_len,cbuf_off;
int sbuf_len,sbuf_off;
fd_set readfds,writefds;
+ int fdin, fdout;
short port=PORT;
int full_log=1;
char *host=SSL_HOST_NAME;
@@ -1402,6 +1403,18 @@
{
FD_ZERO(&readfds);
FD_ZERO(&writefds);
+ fdin = fileno(stdin);
+ if (fdin < 0)
+ {
+ BIO_printf(bio_err,"bad fileno for stdin\n");
+ goto shut;
+ }
+ fdout = fileno(stdout);
+ if (fdout < 0)
+ {
+ BIO_printf(bio_err,"bad fileno for stdout\n");
+ goto shut;
+ }
if ((SSL_version(con) == DTLS1_VERSION) &&
DTLSv1_get_timeout(con, &timeout))
@@ -1468,8 +1481,8 @@
#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) && !defined (OPENSSL_SYS_BEOS_R5)
if (tty_on)
{
- if (read_tty) openssl_fdset(fileno(stdin),&readfds);
- if (write_tty) openssl_fdset(fileno(stdout),&writefds);
+ if (read_tty) openssl_fdset(fdin,&readfds);
+ if (write_tty) openssl_fdset(fdout,&writefds);
}
if (read_ssl)
openssl_fdset(SSL_get_fd(con),&readfds);
@@ -1529,21 +1542,21 @@
/* Under BeOS-R5 the situation is similar to DOS */
i=0;
stdin_set = 0;
- (void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
+ (void)fcntl(fdin, F_SETFL, O_NONBLOCK);
if(!write_tty) {
if(read_tty) {
tv.tv_sec = 1;
tv.tv_usec = 0;
i=select(width,(void *)&readfds,(void *)&writefds,
NULL,&tv);
- if (read(fileno(stdin), sbuf, 0) >= 0)
+ if (read(fdin, sbuf, 0) >= 0)
stdin_set = 1;
if (!i && (stdin_set != 1 || !read_tty))
continue;
} else i=select(width,(void *)&readfds,(void *)&writefds,
NULL,timeoutp);
}
- (void)fcntl(fileno(stdin), F_SETFL, 0);
+ (void)fcntl(fdin, F_SETFL, 0);
#else
i=select(width,(void *)&readfds,(void *)&writefds,
NULL,timeoutp);
@@ -1634,7 +1647,7 @@
/* Assume Windows/DOS/BeOS can always write */
else if (!ssl_pending && write_tty)
#else
- else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
+ else if (!ssl_pending && FD_ISSET(fdout,&writefds))
#endif
{
#ifdef CHARSET_EBCDIC
@@ -1725,7 +1738,7 @@
#elif defined(OPENSSL_SYS_BEOS_R5)
else if (stdin_set)
#else
- else if (FD_ISSET(fileno(stdin),&readfds))
+ else if (FD_ISSET(fdin,&readfds))
#endif
{
if (crlf)
diff -r 3c1832117c4b -r 4ac49bcbdd3b crypto/external/bsd/openssl/dist/apps/s_server.c
--- a/crypto/external/bsd/openssl/dist/apps/s_server.c Wed Aug 17 00:59:47 2011 +0000
+++ b/crypto/external/bsd/openssl/dist/apps/s_server.c Wed Aug 17 05:30:01 2011 +0000
@@ -1857,7 +1857,7 @@
char *buf=NULL;
fd_set readfds;
int ret=1,width;
- int k,i;
+ int k,i, fdin;
unsigned long l;
SSL *con=NULL;
BIO *sbio;
@@ -1999,9 +1999,15 @@
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) && !defined(OPENSSL_SYS_NETWARE) && !defined(OPENSSL_SYS_BEOS_R5)
- openssl_fdset(fileno(stdin),&readfds);
+ openssl_fdset(fdin,&readfds);
#endif
openssl_fdset(s,&readfds);
/* Note: under VMS with SOCKETSHR the second parameter is
@@ -2026,13 +2032,13 @@
/* Under BeOS-R5 the situation is similar to DOS */
tv.tv_sec = 1;
tv.tv_usec = 0;
- (void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
+ (void)fcntl(fdin, F_SETFL, O_NONBLOCK);
i=select(width,(void *)&readfds,NULL,NULL,&tv);
- if ((i < 0) || (!i && read(fileno(stdin), buf, 0) < 0))
+ if ((i < 0) || (!i && read(fdin, buf, 0) < 0))
continue;
- if (read(fileno(stdin), buf, 0) >= 0)
+ if (read(fdin, buf, 0) >= 0)
read_from_terminal = 1;
- (void)fcntl(fileno(stdin), F_SETFL, 0);
+ (void)fcntl(fdin, F_SETFL, 0);
#else
if ((SSL_version(con) == DTLS1_VERSION) &&
DTLSv1_get_timeout(con, &timeout))
@@ -2048,7 +2054,7 @@
}
if (i <= 0) continue;
- if (FD_ISSET(fileno(stdin),&readfds))
+ if (FD_ISSET(fdin,&readfds))
read_from_terminal = 1;
#endif
if (FD_ISSET(s,&readfds))
Home |
Main Index |
Thread Index |
Old Index