liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit d3fce5edd462ddefe2c43e7d401c5969ab60988c
parent 5771108fed5581d53baf43ef9ec26371ac5b2bca
Author: Daniel Barlow <dan@telent.net>
Date:   Mon, 16 Sep 2024 20:35:23 +0100

implement error() for musl

Diffstat:
Mpkgs/logshipper/logtee.c | 18+++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/pkgs/logshipper/logtee.c b/pkgs/logshipper/logtee.c @@ -6,12 +6,28 @@ #include <stdlib.h> #include <unistd.h> #include <fcntl.h> -#include <error.h> #include <signal.h> #include <sys/socket.h> #include <sys/un.h> #include <errno.h> +#ifdef _GNU_SOURCE +#include <error.h> +#else +#include <stdarg.h> +static void error(int status, int errnum, const char * fmt, ...) { + va_list ap; + va_start(ap, fmt); + + fprintf(stderr, "logtee: "); + vfprintf(stderr, fmt, ap); + if(errnum) fprintf(stderr, ": %s", strerror(errnum)); + fprintf(stderr, "\n"); + if(status) exit(status); +} +#endif + + int open_shipper_socket(char *pathname) { int fd; static int fail_count = 0;