From 4add8c9c34c48f01de58b3b41e79a768063f7acf Mon Sep 17 00:00:00 2001 From: Mosder Date: Thu, 23 Jul 2026 20:04:32 +0200 Subject: feat: redirected runtime errors to stderr --- analyzer/analyzer.c | 2 +- analyzer/utils/memory.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'analyzer') diff --git a/analyzer/analyzer.c b/analyzer/analyzer.c index bd24613..aa4a645 100644 --- a/analyzer/analyzer.c +++ b/analyzer/analyzer.c @@ -59,7 +59,7 @@ void analyze_file(char *path) { // handle errors if (handle == NULL) { - printf("Couldn't open the specified file:\n%s\n", errbuf); + fprintf(stderr, "Couldn't open the specified file:\n%s\n", errbuf); return; } diff --git a/analyzer/utils/memory.c b/analyzer/utils/memory.c index 0a43bd3..91c5f18 100644 --- a/analyzer/utils/memory.c +++ b/analyzer/utils/memory.c @@ -11,12 +11,12 @@ void *safe_malloc(size_t size) { if (p) return p; if (i < MAX_ALLOC_ATTEMPTS - 1) { - printf("Failed malloc. Retrying in 1s...\n"); + fprintf(stderr, "Failed malloc. Retrying in 1s...\n"); sleep(1); } } - printf("ERROR: Failed malloc %d times. Exiting...", MAX_ALLOC_ATTEMPTS); + fprintf(stderr, "FATAL: Failed malloc %d times. Exiting...", MAX_ALLOC_ATTEMPTS); exit(EXIT_FAILURE); } @@ -29,12 +29,12 @@ void *safe_realloc(void *ptr, size_t size) { if (p) return p; if (i < MAX_ALLOC_ATTEMPTS - 1) { - printf("Failed realloc. Retrying in 1s...\n"); + fprintf(stderr, "Failed realloc. Retrying in 1s...\n"); sleep(1); } } - printf("ERROR: Failed realloc %d times. Exiting...", MAX_ALLOC_ATTEMPTS); + fprintf(stderr, "FATAL: Failed realloc %d times. Exiting...", MAX_ALLOC_ATTEMPTS); exit(EXIT_FAILURE); } -- cgit v1.2.3