mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-13 03:09:51 +03:00
78 lines
2.3 KiB
Diff
78 lines
2.3 KiB
Diff
From 3030c1258ba1c39ced94b88958c12486be5f6c41 Mon Sep 17 00:00:00 2001
|
|
From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
|
|
Date: Wed, 20 Nov 2024 12:52:27 +0100
|
|
Subject: [PATCH 2/4] mptcpize: define error() if not available
|
|
|
|
Some libc like musl don't support it.
|
|
|
|
It is easy enough to define a simple version for our need.
|
|
|
|
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
|
|
---
|
|
configure.ac | 5 +++++
|
|
src/mptcpize.c | 19 ++++++++++++++++++-
|
|
2 files changed, 23 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index e1bc1ff..fd0e321 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -273,6 +273,11 @@ AC_CHECK_FUNC([l_netlink_message_new_sized],
|
|
[ELL has l_netlink_message_new_sized()])])
|
|
LIBS=$mptcpd_save_libs
|
|
|
|
+# ---------------------------------------------------------------
|
|
+# Checks for header files.
|
|
+# ---------------------------------------------------------------
|
|
+AC_CHECK_HEADERS([error.h])
|
|
+
|
|
# ---------------------------------------------------------------
|
|
# Enable additional C compiler warnings. We do this after all
|
|
# Autoconf tests have been run since not all autoconf macros are
|
|
diff --git a/src/mptcpize.c b/src/mptcpize.c
|
|
index b502d75..e944729 100644
|
|
--- a/src/mptcpize.c
|
|
+++ b/src/mptcpize.c
|
|
@@ -18,7 +18,6 @@
|
|
#include <argp.h>
|
|
#include <dlfcn.h>
|
|
#include <errno.h>
|
|
-#include <error.h>
|
|
#include <fcntl.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
@@ -29,6 +28,10 @@
|
|
# include <mptcpd/private/config.h>
|
|
#endif
|
|
|
|
+#ifdef HAVE_ERROR_H
|
|
+# include <error.h>
|
|
+#endif
|
|
+
|
|
#define SYSTEMD_ENV_VAR "Environment="
|
|
#define SYSTEMD_UNIT_VAR "FragmentPath="
|
|
#define SYSTEMD_SERVICE_TAG "[Service]"
|
|
@@ -53,6 +56,20 @@ static char doc[] =
|
|
"\tdisable <unit> Update the systemd <unit>, removing\n"
|
|
"\t the above launcher.\n";
|
|
|
|
+#ifndef HAVE_ERROR_H
|
|
+# define ERROR_HELPER(status, errnum, format, ...) do { \
|
|
+ if (errnum) { \
|
|
+ errno = errnum; \
|
|
+ perror(format); \
|
|
+ } else { \
|
|
+ fprintf(stderr, format "%s", __VA_ARGS__); \
|
|
+ } \
|
|
+ if (status) \
|
|
+ exit(status); \
|
|
+ } while(0)
|
|
+# define error(...) ERROR_HELPER(__VA_ARGS__, "\n")
|
|
+#endif
|
|
+
|
|
static struct argp const argp = { 0, 0, args_doc, doc, 0, 0, 0 };
|
|
|
|
static void help(void)
|
|
--
|
|
2.45.2
|
|
|