Commit 7768e116 authored by Rich Salz's avatar Rich Salz Committed by Rich Salz
Browse files

Use bio_err not stderr in apps.



Except for VMS startup code.

Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
parent 51b04a61
Loading
Loading
Loading
Loading
+13 −14
Original line number Diff line number Diff line
@@ -264,8 +264,7 @@ static void lock_dbg_cb(int mode, int type, const char *file, int line)

 err:
    if (errstr) {
        /* we cannot use bio_err here */
        fprintf(stderr,
        BIO_printf(bio_err,
                   "openssl (lock_dbg_cb): %s (mode=%d, type=%d) at %s:%d\n",
                   errstr, mode, type, file, line);
    }
@@ -348,6 +347,12 @@ int main(int argc, char *argv[])
    arg.argv = NULL;
    arg.size = 0;

    /* Set up some of the environment. */
    default_config_file = make_config_name();
    bio_in = dup_bio_in();
    bio_out = dup_bio_out();
    bio_err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);

#if defined( OPENSSL_SYS_VMS)
    copied_argv = argv = copy_argv(&argc, argv);
#endif
@@ -369,12 +374,12 @@ int main(int argc, char *argv[])
#ifdef OPENSSL_FIPS
        if (!FIPS_mode_set(1)) {
            ERR_load_crypto_strings();
            ERR_print_errors(BIO_new_fp(stderr, BIO_NOCLOSE));
            EXIT(1);
            ERR_print_errors(bio_err);
            return 1;
        }
#else
        fprintf(stderr, "FIPS mode not supported.\n");
        EXIT(1);
        BIO_printf(bio_err, "FIPS mode not supported.\n");
        return 1;
#endif
    }

@@ -393,12 +398,6 @@ int main(int argc, char *argv[])
    prog = prog_init();
    pname = opt_progname(argv[0]);

    /* Lets load up our environment a little */
    default_config_file = make_config_name();
    bio_in = dup_bio_in();
    bio_out = dup_bio_out();
    bio_err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);

    /* first check the program name */
    f.name = pname;
    fp = lh_FUNCTION_retrieve(prog, &f);
+2 −2
Original line number Diff line number Diff line
@@ -496,7 +496,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,

int passwd_main(int argc, char **argv)
{
    fputs("Program not available.\n", stderr)
    BIO_printf(bio_err, "Program not available.\n");
    return (1);
}
#endif
+3 −2
Original line number Diff line number Diff line
@@ -931,7 +931,8 @@ static int set_cert_cb(SSL *ssl, void *arg)
    static int retry_cnt;
    if (retry_cnt < 5) {
        retry_cnt++;
        fprintf(stderr, "Certificate callback retry test: count %d\n",
        BIO_printf(bio_err,
                   "Certificate callback retry test: count %d\n",
                   retry_cnt);
        return -1;
    }
+4 −4
Original line number Diff line number Diff line
@@ -2376,7 +2376,7 @@ static int init_ssl_connection(SSL *con)
    {
        while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP
               && SSL_state(con) == SSL3_ST_SR_CLNT_HELLO_C) {
            fprintf(stderr,
            BIO_printf(bio_err,
                       "LOOKUP from certificate callback during accept\n");
            i = SSL_accept(con);
        }
@@ -2811,10 +2811,10 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context)

#ifdef RENEG
                total_bytes += i;
                fprintf(stderr, "%d\n", i);
                BIO_printf(bio_err, "%d\n", i);
                if (total_bytes > 3 * 1024) {
                    total_bytes = 0;
                    fprintf(stderr, "RENEGOTIATE\n");
                    BIO_printf(bio_err, "RENEGOTIATE\n");
                    SSL_renegotiate(con);
                }
#endif
+2 −4
Original line number Diff line number Diff line
@@ -539,8 +539,7 @@ static int do_accept(int acc_sock, int *sock, char **host)
             */
            goto redoit;
        }
        fprintf(stderr, "errno=%d ", errno);
        perror("accept");
        BIO_printf(bio_err, "accept errno=%d, %s\n", errno, strerror(errno));
# endif
        return (0);
    }
@@ -597,8 +596,7 @@ static int do_accept_unix(int acc_sock, int *sock)
             */
            goto redoit;
        }
        fprintf(stderr, "errno=%d ", errno);
        perror("accept");
        BIO_printf(bio_err, "accept errno=%d, %s\n", errno, strerror(errno));
        return (0);
    }

Loading