if (CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Qunused-arguments -Wno-deprecated-declarations)
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU")
- add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Wno-error=unknown-pragmas -Wno-deprecated-declarations)
+ add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Wno-error=unknown-pragmas -Wno-error=pragmas -Wno-deprecated-declarations)
elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS)
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <err.h>
/* For X509_NAME_add_entry_by_txt */
#pragma GCC diagnostic ignored "-Wpointer-sign"
/* 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
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);
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);
}
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),