summaryrefslogtreecommitdiffstats
path: root/tests/override_getaddrinfo.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
commitdcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch)
tree66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/override_getaddrinfo.c
parentInitial commit. (diff)
downloadrsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.tar.xz
rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.zip
Adding upstream version 8.2402.0.upstream/8.2402.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/override_getaddrinfo.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/override_getaddrinfo.c b/tests/override_getaddrinfo.c
new file mode 100644
index 0000000..32bbafe
--- /dev/null
+++ b/tests/override_getaddrinfo.c
@@ -0,0 +1,28 @@
+// we need this for dlsym(): #include <dlfcn.h>
+#include "config.h"
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+
+int getaddrinfo(const char *node __attribute__((unused)),
+ const char *service __attribute__((unused)),
+ const struct addrinfo *hints __attribute__((unused)),
+ struct addrinfo **res __attribute__((unused)))
+{
+ return EAI_MEMORY;
+}
+
+static void __attribute__((constructor))
+my_init(void)
+{
+ /* we currently do not need this entry point, but keep it as
+ * a "template". It can be used, e.g. to emit some diagnostic
+ * information:
+ printf("loaded\n");
+ * or - more importantly - obtain a pointer to the overriden
+ * API:
+ orig_etry = dlsym(RTLD_NEXT, "original_entry_point");
+ */
+}