20 lines
718 B
C
20 lines
718 B
C
// Copyright (c) 2026 Storm Dragon
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// Private-test preload: simulate failure to load only Enchant, leaving all
|
|
// other libraries alone. The optional stub exercises missing ABI symbols.
|
|
#define _GNU_SOURCE
|
|
#include <dlfcn.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
void *dlopen(const char *filename, int flags) {
|
|
void *(*realOpen)(const char *, int) = dlsym(RTLD_NEXT, "dlopen");
|
|
if (!realOpen) return NULL;
|
|
if (filename && strcmp(filename, "libenchant-2.so.2") == 0) {
|
|
const char *stubPath = getenv("FENRIR_TEST_ENCHANT_LIBRARY");
|
|
return stubPath && *stubPath ? realOpen(stubPath, flags) : NULL;
|
|
}
|
|
return realOpen(filename, flags);
|
|
}
|