summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ui/ui_openssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ui/ui_openssl.c')
-rw-r--r--src/lib/libcrypto/ui/ui_openssl.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/lib/libcrypto/ui/ui_openssl.c b/src/lib/libcrypto/ui/ui_openssl.c
index 1bc25f48d5..5fbedf6ff8 100644
--- a/src/lib/libcrypto/ui/ui_openssl.c
+++ b/src/lib/libcrypto/ui/ui_openssl.c
@@ -122,9 +122,7 @@
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#ifndef _POSIX_C_SOURCE 125#define _POSIX_C_SOURCE 1
126#define _POSIX_C_SOURCE 2
127#endif
128#include <signal.h> 126#include <signal.h>
129#include <stdio.h> 127#include <stdio.h>
130#include <string.h> 128#include <string.h>
@@ -299,7 +297,7 @@ static int is_a_tty;
299 297
300/* Declare static functions */ 298/* Declare static functions */
301#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) 299#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
302static int read_till_nl(FILE *); 300static void read_till_nl(FILE *);
303static void recsig(int); 301static void recsig(int);
304static void pushsig(void); 302static void pushsig(void);
305static void popsig(void); 303static void popsig(void);
@@ -392,16 +390,15 @@ static int read_string(UI *ui, UI_STRING *uis)
392 390
393#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE) 391#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
394/* Internal functions to read a string without echoing */ 392/* Internal functions to read a string without echoing */
395static int read_till_nl(FILE *in) 393static void read_till_nl(FILE *in)
396 { 394 {
397#define SIZE 4 395#define SIZE 4
398 char buf[SIZE+1]; 396 char buf[SIZE+1];
399 397
400 do { 398 do {
401 if (!fgets(buf,SIZE,in)) 399 if (fgets(buf,sizeof(buf),in) == NULL)
402 return 0; 400 break;
403 } while (strchr(buf,'\n') == NULL); 401 } while (strchr(buf,'\n') == NULL);
404 return 1;
405 } 402 }
406 403
407static volatile sig_atomic_t intr_signal; 404static volatile sig_atomic_t intr_signal;
@@ -449,8 +446,7 @@ static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl)
449 *p='\0'; 446 *p='\0';
450 } 447 }
451 else 448 else
452 if (!read_till_nl(tty_in)) 449 read_till_nl(tty_in);
453 goto error;
454 if (UI_set_result(ui, uis, result) >= 0) 450 if (UI_set_result(ui, uis, result) >= 0)
455 ok=1; 451 ok=1;
456 452
@@ -478,7 +474,7 @@ static int open_console(UI *ui)
478 CRYPTO_w_lock(CRYPTO_LOCK_UI); 474 CRYPTO_w_lock(CRYPTO_LOCK_UI);
479 is_a_tty = 1; 475 is_a_tty = 1;
480 476
481#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS) 477#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE)
482 tty_in=stdin; 478 tty_in=stdin;
483 tty_out=stderr; 479 tty_out=stderr;
484#else 480#else