X-Git-Url: http://www.wagner.pp.ru/gitweb/?a=blobdiff_plain;f=test_tls.c;fp=test_tls.c;h=216fb2a8f263d5922a70d1f2733134011f841057;hb=8fff4a245e57cd2e3479a35cf5a8be534bee5e1c;hp=bee503385c018b603e222d5094b06a81806c0cb0;hpb=47be42da87cb9bf9bad6f415c442b586ce0752ef;p=openssl-gost%2Fengine.git diff --git a/test_tls.c b/test_tls.c index bee5033..216fb2a 100644 --- a/test_tls.c +++ b/test_tls.c @@ -29,7 +29,6 @@ #include #include #include -#include /* For X509_NAME_add_entry_by_txt */ #pragma GCC diagnostic ignored "-Wpointer-sign" @@ -69,6 +68,17 @@ static const char *cipher_list; /* How much K to transfer between client and server. */ #define KTRANSFER (1 * 1024) +static void err(int eval, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + printf(": %s\n", strerror(errno)); + exit(eval); +} + /* * Simple TLS Server code is based on * https://wiki.openssl.org/index.php/Simple_TLS_Server @@ -274,7 +284,7 @@ int test(const char *algname, const char *paramset) ck = certgen(algname, paramset); int sockfd[2]; - if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sockfd) == -1) + if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd) == -1) err(1, "socketpair"); setpgid(0, 0); @@ -307,14 +317,14 @@ int test(const char *algname, const char *paramset) ret = (WIFEXITED(status) && WEXITSTATUS(status)) || (WIFSIGNALED(status) && WTERMSIG(status)); if (ret) { - warnx(cRED "%s child %s with %d %s" cNORM, + fprintf(stderr, cRED "%s child %s with %d %s" cNORM, exited_pid == server_pid? "server" : "client", WIFSIGNALED(status)? "killed" : "exited", WIFSIGNALED(status)? WTERMSIG(status) : WEXITSTATUS(status), WIFSIGNALED(status)? strsignal(WTERMSIG(status)) : ""); /* If first child exited with error, kill other. */ - warnx("terminating %s by force", + fprintf(stderr, "terminating %s by force", exited_pid == server_pid? "client" : "server"); kill(exited_pid == server_pid? client_pid : server_pid, SIGTERM); } @@ -322,7 +332,7 @@ int test(const char *algname, const char *paramset) exited_pid = wait(&status); /* Report error unless we killed it. */ if (!ret && (!WIFEXITED(status) || WEXITSTATUS(status))) - warnx(cRED "%s child %s with %d %s" cNORM, + fprintf(stderr, cRED "%s child %s with %d %s" cNORM, exited_pid == server_pid? "server" : "client", WIFSIGNALED(status)? "killed" : "exited", WIFSIGNALED(status)? WTERMSIG(status) : WEXITSTATUS(status),