diff --git a/src/nix/entrypoint.c b/src/nix/entrypoint.c index 4837e72..457e11d 100644 --- a/src/nix/entrypoint.c +++ b/src/nix/entrypoint.c @@ -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) { @@ -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 " @@ -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__) @@ -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); diff --git a/src/nix/logger.h b/src/nix/logger.h index 8515325..cb1d218 100644 --- a/src/nix/logger.h +++ b/src/nix/logger.h @@ -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); \ }