AtlatestRepositorysigil-ui

sigil-ui / tree / testdeny-fontconfig.c

1/* Native interception fixture; its controller is a Sigil script. */
2#define _GNU_SOURCE
3#include <dlfcn.h>
4#include <stdio.h>
5#include <string.h>
6
7void *dlopen(const char *name, int flags)
8{
9 const char *base = name ? strrchr(name, '/') : NULL;
10 base = base ? base + 1 : name;
11 if (base && (!strcmp(base, "libfontconfig.so.1") || !strcmp(base, "libfontconfig.so"))) {
12 fputs("DENY_FONTCONFIG\n", stderr);
13 return NULL;
14 }
15 void *(*open_library)(const char *, int) = dlsym(RTLD_NEXT, "dlopen");
16 return open_library ? open_library(name, flags) : NULL;