From a3817b4faca8cec11304cdd20b284d152f0189d4 Mon Sep 17 00:00:00 2001 From: Trevor Hickey Date: Sat, 29 May 2021 01:09:15 -0400 Subject: [PATCH] avoid stderr when DEBUG is not being used Should we hide these messages under normal operation? I'm using tardis as a wrapper tool, where stdout/stderr should be the same regardless of if the wrapper is used. --- tardis.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tardis.c b/tardis.c index 6bdcdd6..5a8830e 100644 --- a/tardis.c +++ b/tardis.c @@ -169,15 +169,17 @@ int main(int argc, char *argv[], char *envp[]) { perror("execvpe"); // execvpe only returns on error exit(-1); } - - fprintf(stderr, "Child spawned with PID %d\n", child); - + #ifdef DEBUG + fprintf(stderr, "Child spawned with PID %d\n", child); + #endif ptrace(PTRACE_SEIZE, child, 0, PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEEXEC | PTRACE_O_EXITKILL | PTRACE_O_TRACEFORK | PTRACE_O_TRACEVFORK | PTRACE_O_TRACECLONE); wait(NULL); // wait for SIGSTOP to happen ptrace(PTRACE_SYSCALL, child, 0, 0); // continue execution if (is64bit(child)) { - fprintf(stderr, "Child is 64-bit\n"); + #ifdef DEBUG + fprintf(stderr, "Child is 64-bit\n"); + #endif } else { fprintf(stderr, "ERROR: 32-bit processes are currently unsupported\n"); exit(-1);