summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-04-19 16:31:52 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-04-19 16:31:52 +0000
commitd006089d37b019ea459acd28cc0d43e64105f03f (patch)
tree7107d70085dab63a7d7429f3aecf777de828238d /lib
parent26e2d83884a2dee3b254794b14c507eb85e7e14c (diff)
ReadFile() and GetStdHandle() are not very POSIX.
ok beck jsing
Diffstat (limited to 'lib')
-rw-r--r--lib/libssl/src/apps/apps.c37
-rw-r--r--lib/libssl/src/apps/apps.h2
-rw-r--r--lib/libssl/src/apps/s_client.c6
-rw-r--r--lib/libssl/src/apps/s_server.c6
4 files changed, 6 insertions, 45 deletions
diff --git a/lib/libssl/src/apps/apps.c b/lib/libssl/src/apps/apps.c
index 6413d5c4378..3a6c3b9bdd9 100644
--- a/lib/libssl/src/apps/apps.c
+++ b/lib/libssl/src/apps/apps.c
@@ -2513,40 +2513,3 @@ app_isdir(const char *name)
return -1;
#endif
}
-
-/* raw_read|write section */
-#if defined(_WIN32) && defined(STD_INPUT_HANDLE)
-int
-raw_read_stdin(void *buf, int siz)
-{
- DWORD n;
- if (ReadFile(GetStdHandle(STD_INPUT_HANDLE), buf, siz, &n, NULL))
- return (n);
- else
- return (-1);
-}
-#else
-int
-raw_read_stdin(void *buf, int siz)
-{
- return read(fileno(stdin), buf, siz);
-}
-#endif
-
-#if defined(_WIN32) && defined(STD_OUTPUT_HANDLE)
-int
-raw_write_stdout(const void *buf, int siz)
-{
- DWORD n;
- if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buf, siz, &n, NULL))
- return (n);
- else
- return (-1);
-}
-#else
-int
-raw_write_stdout(const void *buf, int siz)
-{
- return write(fileno(stdout), buf, siz);
-}
-#endif
diff --git a/lib/libssl/src/apps/apps.h b/lib/libssl/src/apps/apps.h
index 55015024e9d..eae0f4708a3 100644
--- a/lib/libssl/src/apps/apps.h
+++ b/lib/libssl/src/apps/apps.h
@@ -320,8 +320,6 @@ unsigned char *next_protos_parse(unsigned short *outlen, const char *in);
#define SERIAL_RAND_BITS 64
int app_isdir(const char *);
-int raw_read_stdin(void *, int);
-int raw_write_stdout(const void *, int);
#define TM_START 0
#define TM_STOP 1
diff --git a/lib/libssl/src/apps/s_client.c b/lib/libssl/src/apps/s_client.c
index 8c71d6b6ae9..fada0827a47 100644
--- a/lib/libssl/src/apps/s_client.c
+++ b/lib/libssl/src/apps/s_client.c
@@ -1524,7 +1524,7 @@ re_start:
goto shut;
}
} else if (!ssl_pending && FD_ISSET(fileno(stdout), &writefds)) {
- i = raw_write_stdout(&(sbuf[sbuf_off]), sbuf_len);
+ i = write(fileno(stdout), &(sbuf[sbuf_off]), sbuf_len);
if (i <= 0) {
BIO_printf(bio_c_out, "DONE\n");
@@ -1601,7 +1601,7 @@ re_start:
if (crlf) {
int j, lf_num;
- i = raw_read_stdin(cbuf, BUFSIZZ / 2);
+ i = read(fileno(stdin), cbuf, BUFSIZZ / 2);
lf_num = 0;
/* both loops are skipped when i <= 0 */
for (j = 0; j < i; j++)
@@ -1617,7 +1617,7 @@ re_start:
}
assert(lf_num == 0);
} else
- i = raw_read_stdin(cbuf, BUFSIZZ);
+ i = read(fileno(stdin), cbuf, BUFSIZZ);
if ((!c_ign_eof) && ((i <= 0) || (cbuf[0] == 'Q'))) {
BIO_printf(bio_err, "DONE\n");
diff --git a/lib/libssl/src/apps/s_server.c b/lib/libssl/src/apps/s_server.c
index 3dd22e6b7a8..1082ee51eea 100644
--- a/lib/libssl/src/apps/s_server.c
+++ b/lib/libssl/src/apps/s_server.c
@@ -1805,7 +1805,7 @@ sv_body(char *hostname, int s, unsigned char *context)
if (s_crlf) {
int j, lf_num;
- i = raw_read_stdin(buf, bufsize / 2);
+ i = read(fileno(stdin), buf, bufsize / 2);
lf_num = 0;
/* both loops are skipped when i <= 0 */
for (j = 0; j < i; j++)
@@ -1821,7 +1821,7 @@ sv_body(char *hostname, int s, unsigned char *context)
}
assert(lf_num == 0);
} else
- i = raw_read_stdin(buf, bufsize);
+ i = read(fileno(stdin), buf, bufsize);
if (!s_quiet) {
if ((i <= 0) || (buf[0] == 'Q')) {
BIO_printf(bio_s_out, "DONE\n");
@@ -1954,7 +1954,7 @@ sv_body(char *hostname, int s, unsigned char *context)
#endif
switch (SSL_get_error(con, i)) {
case SSL_ERROR_NONE:
- raw_write_stdout(buf,
+ write(fileno(stdout), buf,
(unsigned int) i);
if (SSL_pending(con))
goto again;