From 3b6b3af629367534c3e91676dc613f993a6a6314 Mon Sep 17 00:00:00 2001 From: tron Date: Sat, 6 Aug 2005 16:55:05 +0000 Subject: (svn r2818) Don't tell the world about a local variable which is only used once --- dedicated.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'dedicated.c') diff --git a/dedicated.c b/dedicated.c index 77be5fe37..1905fa498 100644 --- a/dedicated.c +++ b/dedicated.c @@ -20,25 +20,28 @@ void DedicatedFork(void) case -1: perror("Unable to fork"); exit(1); - case 0: - // We're the child + + case 0: { // We're the child + FILE* f; /* Open the log-file to log all stuff too */ - _log_file_fd = fopen(_log_file, "a"); - if (!_log_file_fd) { + f = fopen(_log_file, "a"); + if (f == NULL) { perror("Unable to open logfile"); exit(1); } /* Redirect stdout and stderr to log-file */ - if (dup2(fileno(_log_file_fd), fileno(stdout)) == -1) { + if (dup2(fileno(f), fileno(stdout)) == -1) { perror("Rerouting stdout"); exit(1); } - if (dup2(fileno(_log_file_fd), fileno(stderr)) == -1) { + if (dup2(fileno(f), fileno(stderr)) == -1) { perror("Rerouting stderr"); exit(1); } break; + } + default: // We're the parent printf("Loading dedicated server...\n"); -- cgit v1.2.3-70-g09d2