diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2018-06-01 23:09:09 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2018-06-01 23:09:09 +0200 |
commit | 94f97f09d6acb69ade8cfd9f01a6204607be15e8 (patch) | |
tree | 244bcb9cda9b3b7522b3e23bf8b9a264bdd9a319 | |
parent | ceae0f10b1d03ec6ba2748357c4bf5232817e9fa (diff) |
POTD skeleton #90.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | src/log_colored.c | 24 | ||||
-rw-r--r-- | src/log_file.c | 24 | ||||
-rw-r--r-- | src/pevent.c | 4 | ||||
-rw-r--r-- | src/utils.h | 1 |
5 files changed, 30 insertions, 29 deletions
diff --git a/configure.ac b/configure.ac index 50b7751..eb612ba 100644 --- a/configure.ac +++ b/configure.ac @@ -48,8 +48,8 @@ AC_SUBST([libssh_CFLAGS]) AC_SUBST([libssh_LIBS]) dnl libseccomp-dev -PKG_CHECK_MODULES([libseccomp], [libseccomp >= 2.3.1], [], - [ AC_MSG_ERROR([libseccomp >= 2.3.1 not found]) ]) +PKG_CHECK_MODULES([libseccomp], [libseccomp >= 2.2.1], [], + [ AC_MSG_ERROR([libseccomp >= 2.2.1 not found]) ]) AC_SUBST([libseccomp_CFLAGS]) AC_SUBST([libseccomp_LIBS]) @@ -57,7 +57,7 @@ dnl Check for valgrind PKG_CHECK_MODULES([valgrind], [valgrind >= 3.12.0], [ AC_DEFINE([HAVE_VALGRIND], [1], [Define to 1 if you have/want valgrind support]) ], - [ AC_MSG_ERROR([valgrind >= 3.12.0 not found]) ]) + []) AC_SUBST([valgrind_CFLAGS]) AC_SUBST([valgrind_LIBS]) diff --git a/src/log_colored.c b/src/log_colored.c index bd9f243..6fa4e7c 100644 --- a/src/log_colored.c +++ b/src/log_colored.c @@ -79,18 +79,18 @@ void log_fmtex_colored(log_priority prio, const char *srcfile, my_pid = getpid(); switch (prio) { case DEBUG: - printf("[DEBUG] [%d] %s.%lu: %s\n", my_pid, srcfile, line, out); + printf("[DEBUG] [%d] %s.%zu: %s\n", my_pid, srcfile, line, out); break; case NOTICE: - printf("[" GRN "NOTICE" RESET "] [%d] %s.%lu: %s\n", + printf("[" GRN "NOTICE" RESET "] [%d] %s.%zu: %s\n", my_pid, srcfile, line, out); break; case WARNING: - printf("[" YEL "WARNING" RESET "][%d] %s.%lu: %s\n", + printf("[" YEL "WARNING" RESET "][%d] %s.%zu: %s\n", my_pid, srcfile, line, out); break; case ERROR: - printf("[" RED "ERROR" RESET "] [%d] %s.%lu: %s\n", + printf("[" RED "ERROR" RESET "] [%d] %s.%zu: %s\n", my_pid, srcfile, line, out); break; case CMD: @@ -117,40 +117,40 @@ void log_fmtexerr_colored(log_priority prio, const char *srcfile, switch (prio) { case DEBUG: if (saved_errno) - printf("[DEBUG] [%d] %s.%lu: %s failed: %s\n", + printf("[DEBUG] [%d] %s.%zu: %s failed: %s\n", my_pid, srcfile, line, out, strerror(saved_errno)); else - printf("[DEBUG] [%d] %s.%lu: %s failed\n", + printf("[DEBUG] [%d] %s.%zu: %s failed\n", my_pid, srcfile, line, out); break; case NOTICE: if (saved_errno) - printf("[" GRN "NOTICE" RESET "] [%d] %s.%lu: %s failed: %s\n", + printf("[" GRN "NOTICE" RESET "] [%d] %s.%zu: %s failed: %s\n", my_pid, srcfile, line, out, strerror(saved_errno)); else - printf("[" GRN "NOTICE" RESET "] [%d] %s.%lu: %s failed\n", + printf("[" GRN "NOTICE" RESET "] [%d] %s.%zu: %s failed\n", my_pid, srcfile, line, out); break; case WARNING: if (saved_errno) - printf("[" YEL "WARNING" RESET "][%d] %s.%lu: %s failed: %s\n", + printf("[" YEL "WARNING" RESET "][%d] %s.%zu: %s failed: %s\n", my_pid, srcfile, line, out, strerror(saved_errno)); else - printf("[" YEL "WARNING" RESET "][%d] %s.%lu: %s failed\n", + printf("[" YEL "WARNING" RESET "][%d] %s.%zu: %s failed\n", my_pid, srcfile, line, out); break; case ERROR: if (saved_errno) - printf("[" RED "ERROR" RESET "] [%d] %s.%lu: %s failed: %s\n", + printf("[" RED "ERROR" RESET "] [%d] %s.%zu: %s failed: %s\n", my_pid, srcfile, line, out, strerror(saved_errno)); else - printf("[" RED "ERROR" RESET "] [%d] %s.%lu: %s failed\n", + printf("[" RED "ERROR" RESET "] [%d] %s.%zu: %s failed\n", my_pid, srcfile, line, out); break; diff --git a/src/log_file.c b/src/log_file.c index f0a78f2..c9c9f12 100644 --- a/src/log_file.c +++ b/src/log_file.c @@ -89,19 +89,19 @@ void log_fmtex_file(log_priority prio, const char *srcfile, my_pid = getpid(); switch (prio) { case DEBUG: - fprintf(flog, "[DEBUG] [%d] %s.%lu: %s\n", my_pid, srcfile, + fprintf(flog, "[DEBUG] [%d] %s.%zu: %s\n", my_pid, srcfile, line, out); break; case NOTICE: - fprintf(flog, "[NOTICE] [%d] %s.%lu: %s\n", + fprintf(flog, "[NOTICE] [%d] %s.%zu: %s\n", my_pid, srcfile, line, out); break; case WARNING: - fprintf(flog, "[WARNING][%d] %s.%lu: %s\n", + fprintf(flog, "[WARNING][%d] %s.%zu: %s\n", my_pid, srcfile, line, out); break; case ERROR: - fprintf(flog, "[ERROR] [%d] %s.%lu: %s\n", + fprintf(flog, "[ERROR] [%d] %s.%zu: %s\n", my_pid, srcfile, line, out); break; case CMD: @@ -128,40 +128,40 @@ void log_fmtexerr_file(log_priority prio, const char *srcfile, switch (prio) { case DEBUG: if (saved_errno) - fprintf(flog, "[DEBUG] [%d] %s.%lu: %s failed: %s\n", + fprintf(flog, "[DEBUG] [%d] %s.%zu: %s failed: %s\n", my_pid, srcfile, line, out, strerror(saved_errno)); else - fprintf(flog, "[DEBUG] [%d] %s.%lu: %s failed\n", + fprintf(flog, "[DEBUG] [%d] %s.%zu: %s failed\n", my_pid, srcfile, line, out); break; case NOTICE: if (saved_errno) - fprintf(flog, "[NOTICE] [%d] %s.%lu: %s failed: %s\n", + fprintf(flog, "[NOTICE] [%d] %s.%zu: %s failed: %s\n", my_pid, srcfile, line, out, strerror(saved_errno)); else - fprintf(flog, "[NOTICE] [%d] %s.%lu: %s failed\n", + fprintf(flog, "[NOTICE] [%d] %s.%zu: %s failed\n", my_pid, srcfile, line, out); break; case WARNING: if (saved_errno) - fprintf(flog, "[WARNING][%d] %s.%lu: %s failed: %s\n", + fprintf(flog, "[WARNING][%d] %s.%zu: %s failed: %s\n", my_pid, srcfile, line, out, strerror(saved_errno)); else - fprintf(flog, "[WARNING][%d] %s.%lu: %s failed\n", + fprintf(flog, "[WARNING][%d] %s.%zu: %s failed\n", my_pid, srcfile, line, out); break; case ERROR: if (saved_errno) - fprintf(flog, "[ERROR] [%d] %s.%lu: %s failed: %s\n", + fprintf(flog, "[ERROR] [%d] %s.%zu: %s failed: %s\n", my_pid, srcfile, line, out, strerror(saved_errno)); else - fprintf(flog, "[ERROR] [%d] %s.%lu: %s failed\n", + fprintf(flog, "[ERROR] [%d] %s.%zu: %s failed\n", my_pid, srcfile, line, out); break; diff --git a/src/pevent.c b/src/pevent.c index ea29825..e377f29 100644 --- a/src/pevent.c +++ b/src/pevent.c @@ -185,7 +185,7 @@ event_forward_connection(event_ctx *ctx, int dest_fd, on_data_cb on_data, rc = CON_IN_TERMINATED; break; default: - D2("Read %lu bytes from fd %d", siz, ev->data.fd); + D2("Read %zu bytes from fd %d", siz, ev->data.fd); break; } @@ -213,7 +213,7 @@ event_forward_connection(event_ctx *ctx, int dest_fd, on_data_cb on_data, rc = CON_OUT_TERMINATED; break; default: - D2("Written %lu bytes from fd %d to fd %d", + D2("Written %zu bytes from fd %d to fd %d", siz, ev->data.fd, dest_fd); break; } diff --git a/src/utils.h b/src/utils.h index 75f3c92..b4baa70 100644 --- a/src/utils.h +++ b/src/utils.h @@ -2,6 +2,7 @@ #define POTD_UTILS_H 1 #include <stdlib.h> +#include <sys/types.h> #ifndef SIZEOF #define SIZEOF(arr) (sizeof(arr)/sizeof(arr[0])) |