diff options
Diffstat (limited to 'src/lib/libcrypto/ui/ui_openssl.c')
-rw-r--r-- | src/lib/libcrypto/ui/ui_openssl.c | 51 |
1 files changed, 10 insertions, 41 deletions
diff --git a/src/lib/libcrypto/ui/ui_openssl.c b/src/lib/libcrypto/ui/ui_openssl.c index 1f23a45a33..d03aeba91a 100644 --- a/src/lib/libcrypto/ui/ui_openssl.c +++ b/src/lib/libcrypto/ui/ui_openssl.c | |||
@@ -117,17 +117,6 @@ | |||
117 | 117 | ||
118 | #include <openssl/e_os2.h> | 118 | #include <openssl/e_os2.h> |
119 | 119 | ||
120 | /* need for #define _POSIX_C_SOURCE arises whenever you pass -ansi to gcc | ||
121 | * [maybe others?], because it masks interfaces not discussed in standard, | ||
122 | * sigaction and fileno included. -pedantic would be more appropriate for | ||
123 | * the intended purposes, but we can't prevent users from adding -ansi. | ||
124 | */ | ||
125 | #define _POSIX_C_SOURCE 1 | ||
126 | #include <signal.h> | ||
127 | #include <stdio.h> | ||
128 | #include <string.h> | ||
129 | #include <errno.h> | ||
130 | |||
131 | #if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) | 120 | #if !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_VMS) |
132 | # ifdef OPENSSL_UNISTD | 121 | # ifdef OPENSSL_UNISTD |
133 | # include OPENSSL_UNISTD | 122 | # include OPENSSL_UNISTD |
@@ -156,6 +145,10 @@ | |||
156 | /* 06-Apr-92 Luke Brennan Support for VMS */ | 145 | /* 06-Apr-92 Luke Brennan Support for VMS */ |
157 | #include "ui_locl.h" | 146 | #include "ui_locl.h" |
158 | #include "cryptlib.h" | 147 | #include "cryptlib.h" |
148 | #include <signal.h> | ||
149 | #include <stdio.h> | ||
150 | #include <string.h> | ||
151 | #include <errno.h> | ||
159 | 152 | ||
160 | #ifdef OPENSSL_SYS_VMS /* prototypes for sys$whatever */ | 153 | #ifdef OPENSSL_SYS_VMS /* prototypes for sys$whatever */ |
161 | # include <starlet.h> | 154 | # include <starlet.h> |
@@ -206,12 +199,6 @@ | |||
206 | #undef SGTTY | 199 | #undef SGTTY |
207 | #endif | 200 | #endif |
208 | 201 | ||
209 | #if defined(OPENSSL_SYS_NETWARE) | ||
210 | #undef TERMIOS | ||
211 | #undef TERMIO | ||
212 | #undef SGTTY | ||
213 | #endif | ||
214 | |||
215 | #ifdef TERMIOS | 202 | #ifdef TERMIOS |
216 | # include <termios.h> | 203 | # include <termios.h> |
217 | # define TTY_STRUCT struct termios | 204 | # define TTY_STRUCT struct termios |
@@ -260,7 +247,7 @@ struct IOSB { | |||
260 | typedef int sig_atomic_t; | 247 | typedef int sig_atomic_t; |
261 | #endif | 248 | #endif |
262 | 249 | ||
263 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(MAC_OS_GUSI_SOURCE) || defined(OPENSSL_SYS_NETWARE) | 250 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(MAC_OS_GUSI_SOURCE) |
264 | /* | 251 | /* |
265 | * This one needs work. As a matter of fact the code is unoperational | 252 | * This one needs work. As a matter of fact the code is unoperational |
266 | * and this is only a trick to get it compiled. | 253 | * and this is only a trick to get it compiled. |
@@ -396,7 +383,8 @@ static void read_till_nl(FILE *in) | |||
396 | char buf[SIZE+1]; | 383 | char buf[SIZE+1]; |
397 | 384 | ||
398 | do { | 385 | do { |
399 | fgets(buf,SIZE,in); | 386 | if (fgets(buf,sizeof(buf),in) == NULL) |
387 | break; | ||
400 | } while (strchr(buf,'\n') == NULL); | 388 | } while (strchr(buf,'\n') == NULL); |
401 | } | 389 | } |
402 | 390 | ||
@@ -473,7 +461,7 @@ static int open_console(UI *ui) | |||
473 | CRYPTO_w_lock(CRYPTO_LOCK_UI); | 461 | CRYPTO_w_lock(CRYPTO_LOCK_UI); |
474 | is_a_tty = 1; | 462 | is_a_tty = 1; |
475 | 463 | ||
476 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) | 464 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) |
477 | tty_in=stdin; | 465 | tty_in=stdin; |
478 | tty_out=stderr; | 466 | tty_out=stderr; |
479 | #else | 467 | #else |
@@ -489,7 +477,7 @@ static int open_console(UI *ui) | |||
489 | #endif | 477 | #endif |
490 | 478 | ||
491 | #if defined(TTY_get) && !defined(OPENSSL_SYS_VMS) | 479 | #if defined(TTY_get) && !defined(OPENSSL_SYS_VMS) |
492 | if (TTY_get(fileno(tty_in),&tty_orig) == -1) | 480 | if (TTY_get(fileno(tty_in),&tty_orig) == -1) |
493 | { | 481 | { |
494 | #ifdef ENOTTY | 482 | #ifdef ENOTTY |
495 | if (errno == ENOTTY) | 483 | if (errno == ENOTTY) |
@@ -578,9 +566,7 @@ static int close_console(UI *ui) | |||
578 | /* Internal functions to handle signals and act on them */ | 566 | /* Internal functions to handle signals and act on them */ |
579 | static void pushsig(void) | 567 | static void pushsig(void) |
580 | { | 568 | { |
581 | #ifndef OPENSSL_SYS_WIN32 | ||
582 | int i; | 569 | int i; |
583 | #endif | ||
584 | #ifdef SIGACTION | 570 | #ifdef SIGACTION |
585 | struct sigaction sa; | 571 | struct sigaction sa; |
586 | 572 | ||
@@ -588,14 +574,6 @@ static void pushsig(void) | |||
588 | sa.sa_handler=recsig; | 574 | sa.sa_handler=recsig; |
589 | #endif | 575 | #endif |
590 | 576 | ||
591 | #ifdef OPENSSL_SYS_WIN32 | ||
592 | savsig[SIGABRT]=signal(SIGABRT,recsig); | ||
593 | savsig[SIGFPE]=signal(SIGFPE,recsig); | ||
594 | savsig[SIGILL]=signal(SIGILL,recsig); | ||
595 | savsig[SIGINT]=signal(SIGINT,recsig); | ||
596 | savsig[SIGSEGV]=signal(SIGSEGV,recsig); | ||
597 | savsig[SIGTERM]=signal(SIGTERM,recsig); | ||
598 | #else | ||
599 | for (i=1; i<NX509_SIG; i++) | 577 | for (i=1; i<NX509_SIG; i++) |
600 | { | 578 | { |
601 | #ifdef SIGUSR1 | 579 | #ifdef SIGUSR1 |
@@ -616,7 +594,6 @@ static void pushsig(void) | |||
616 | savsig[i]=signal(i,recsig); | 594 | savsig[i]=signal(i,recsig); |
617 | #endif | 595 | #endif |
618 | } | 596 | } |
619 | #endif | ||
620 | 597 | ||
621 | #ifdef SIGWINCH | 598 | #ifdef SIGWINCH |
622 | signal(SIGWINCH,SIG_DFL); | 599 | signal(SIGWINCH,SIG_DFL); |
@@ -625,15 +602,8 @@ static void pushsig(void) | |||
625 | 602 | ||
626 | static void popsig(void) | 603 | static void popsig(void) |
627 | { | 604 | { |
628 | #ifdef OPENSSL_SYS_WIN32 | ||
629 | signal(SIGABRT,savsig[SIGABRT]); | ||
630 | signal(SIGFPE,savsig[SIGFPE]); | ||
631 | signal(SIGILL,savsig[SIGILL]); | ||
632 | signal(SIGINT,savsig[SIGINT]); | ||
633 | signal(SIGSEGV,savsig[SIGSEGV]); | ||
634 | signal(SIGTERM,savsig[SIGTERM]); | ||
635 | #else | ||
636 | int i; | 605 | int i; |
606 | |||
637 | for (i=1; i<NX509_SIG; i++) | 607 | for (i=1; i<NX509_SIG; i++) |
638 | { | 608 | { |
639 | #ifdef SIGUSR1 | 609 | #ifdef SIGUSR1 |
@@ -650,7 +620,6 @@ static void popsig(void) | |||
650 | signal(i,savsig[i]); | 620 | signal(i,savsig[i]); |
651 | #endif | 621 | #endif |
652 | } | 622 | } |
653 | #endif | ||
654 | } | 623 | } |
655 | 624 | ||
656 | static void recsig(int i) | 625 | static void recsig(int i) |