Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/nix/entrypoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ __attribute__((constructor)) void doorstop_ctor() {
}

if (plthook_replace(hook, "dlsym", &dlsym_hook, NULL) != 0)
printf("Failed to hook dlsym, ignoring it. Error: %s\n",
LOG("Failed to hook dlsym, ignoring it. Error: %s",
plthook_error());

if (config.boot_config_override) {
Expand All @@ -132,11 +132,11 @@ __attribute__((constructor)) void doorstop_ctor() {

#if !defined(__APPLE__)
if (plthook_replace(hook, "fopen64", &fopen64_hook, NULL) != 0)
printf("Failed to hook fopen64, ignoring it. Error: %s\n",
LOG("Failed to hook fopen64, ignoring it. Error: %s",
plthook_error());
#endif
if (plthook_replace(hook, "fopen", &fopen_hook, NULL) != 0)
printf("Failed to hook fopen, ignoring it. Error: %s\n",
LOG("Failed to hook fopen, ignoring it. Error: %s",
plthook_error());
} else {
LOG("The boot.config file won't be overriden because the provided "
Expand All @@ -146,11 +146,11 @@ __attribute__((constructor)) void doorstop_ctor() {
}

if (plthook_replace(hook, "fclose", &fclose_hook, NULL) != 0)
printf("Failed to hook fclose, ignoring it. Error: %s\n",
LOG("Failed to hook fclose, ignoring it. Error: %s",
plthook_error());

if (plthook_replace(hook, "dup2", &dup2_hook, NULL) != 0)
printf("Failed to hook dup2, ignoring it. Error: %s\n",
LOG("Failed to hook dup2, ignoring it. Error: %s",
plthook_error());

#if defined(__APPLE__)
Expand All @@ -162,7 +162,7 @@ __attribute__((constructor)) void doorstop_ctor() {
void *mono_handle = plthook_handle_by_name("libmono");

if (plthook_replace(hook, "mono_jit_init_version", &init_mono, NULL) != 0)
printf("Failed to hook jit_init_version, ignoring it. This is probably fine unless you see other errors. Error: %s\n",
LOG("Failed to hook jit_init_version, ignoring it. This is probably fine unless you see other errors. Error: %s",
plthook_error());
else if (mono_handle)
load_mono_funcs(mono_handle);
Expand Down
6 changes: 3 additions & 3 deletions src/nix/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
#define LOGGER_NIX_H
#if VERBOSE

#define LOG(message, ...) printf("[Doorstop] " message "\n", ##__VA_ARGS__)
#define LOG(message, ...) fprintf(stderr, "[Doorstop] " message "\n", ##__VA_ARGS__)

#define ASSERT_F(test, message, ...) \
if (!(test)) { \
printf("[Doorstop][Fatal] " message "\n", ##__VA_ARGS__); \
fprintf(stderr, "[Doorstop][Fatal] " message "\n", ##__VA_ARGS__); \
exit(1); \
}

#define ASSERT(test, message) \
if (!(test)) { \
printf("[Doorstop][Fatal] " message "\n"); \
fprintf(stderr, "[Doorstop][Fatal] " message "\n"); \
exit(1); \
}

Expand Down