diff options
| author | djm <> | 2010-10-01 22:54:21 +0000 |
|---|---|---|
| committer | djm <> | 2010-10-01 22:54:21 +0000 |
| commit | 829fd51d4f8dde4a7f3bf54754f3c1d1a502f5e2 (patch) | |
| tree | e03b9f1bd051e844b971936729e9df549a209130 /src/lib/libcrypto/ui/ui_openssl.c | |
| parent | e6b755d2a53d3cac7a344dfdd6bf7c951cac754c (diff) | |
| download | openbsd-829fd51d4f8dde4a7f3bf54754f3c1d1a502f5e2.tar.gz openbsd-829fd51d4f8dde4a7f3bf54754f3c1d1a502f5e2.tar.bz2 openbsd-829fd51d4f8dde4a7f3bf54754f3c1d1a502f5e2.zip | |
import OpenSSL-1.0.0a
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/ui/ui_openssl.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/lib/libcrypto/ui/ui_openssl.c b/src/lib/libcrypto/ui/ui_openssl.c index ef930bf247..1bc25f48d5 100644 --- a/src/lib/libcrypto/ui/ui_openssl.c +++ b/src/lib/libcrypto/ui/ui_openssl.c | |||
| @@ -122,7 +122,9 @@ | |||
| 122 | * sigaction and fileno included. -pedantic would be more appropriate for | 122 | * sigaction and fileno included. -pedantic would be more appropriate for |
| 123 | * the intended purposes, but we can't prevent users from adding -ansi. | 123 | * the intended purposes, but we can't prevent users from adding -ansi. |
| 124 | */ | 124 | */ |
| 125 | #define _POSIX_C_SOURCE 1 | 125 | #ifndef _POSIX_C_SOURCE |
| 126 | #define _POSIX_C_SOURCE 2 | ||
| 127 | #endif | ||
| 126 | #include <signal.h> | 128 | #include <signal.h> |
| 127 | #include <stdio.h> | 129 | #include <stdio.h> |
| 128 | #include <string.h> | 130 | #include <string.h> |
| @@ -297,7 +299,7 @@ static int is_a_tty; | |||
| 297 | 299 | ||
| 298 | /* Declare static functions */ | 300 | /* Declare static functions */ |
| 299 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) | 301 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) |
| 300 | static void read_till_nl(FILE *); | 302 | static int read_till_nl(FILE *); |
| 301 | static void recsig(int); | 303 | static void recsig(int); |
| 302 | static void pushsig(void); | 304 | static void pushsig(void); |
| 303 | static void popsig(void); | 305 | static void popsig(void); |
| @@ -390,14 +392,16 @@ static int read_string(UI *ui, UI_STRING *uis) | |||
| 390 | 392 | ||
| 391 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) | 393 | #if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) |
| 392 | /* Internal functions to read a string without echoing */ | 394 | /* Internal functions to read a string without echoing */ |
| 393 | static void read_till_nl(FILE *in) | 395 | static int read_till_nl(FILE *in) |
| 394 | { | 396 | { |
| 395 | #define SIZE 4 | 397 | #define SIZE 4 |
| 396 | char buf[SIZE+1]; | 398 | char buf[SIZE+1]; |
| 397 | 399 | ||
| 398 | do { | 400 | do { |
| 399 | fgets(buf,SIZE,in); | 401 | if (!fgets(buf,SIZE,in)) |
| 402 | return 0; | ||
| 400 | } while (strchr(buf,'\n') == NULL); | 403 | } while (strchr(buf,'\n') == NULL); |
| 404 | return 1; | ||
| 401 | } | 405 | } |
| 402 | 406 | ||
| 403 | static volatile sig_atomic_t intr_signal; | 407 | static volatile sig_atomic_t intr_signal; |
| @@ -445,7 +449,8 @@ static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl) | |||
| 445 | *p='\0'; | 449 | *p='\0'; |
| 446 | } | 450 | } |
| 447 | else | 451 | else |
| 448 | read_till_nl(tty_in); | 452 | if (!read_till_nl(tty_in)) |
| 453 | goto error; | ||
| 449 | if (UI_set_result(ui, uis, result) >= 0) | 454 | if (UI_set_result(ui, uis, result) >= 0) |
| 450 | ok=1; | 455 | ok=1; |
| 451 | 456 | ||
| @@ -473,7 +478,7 @@ static int open_console(UI *ui) | |||
| 473 | CRYPTO_w_lock(CRYPTO_LOCK_UI); | 478 | CRYPTO_w_lock(CRYPTO_LOCK_UI); |
| 474 | is_a_tty = 1; | 479 | is_a_tty = 1; |
| 475 | 480 | ||
| 476 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) | 481 | #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS) |
| 477 | tty_in=stdin; | 482 | tty_in=stdin; |
| 478 | tty_out=stderr; | 483 | tty_out=stderr; |
| 479 | #else | 484 | #else |
