diff options
author | tron <tron@openttd.org> | 2005-08-06 16:55:05 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-08-06 16:55:05 +0000 |
commit | cfda4bb38cd31f09df024f9d1f9c65178ebeb312 (patch) | |
tree | ecb10706a35909845b23027c8cc94c56a709a609 | |
parent | 9952ff0b597c3e9da0c9105cc6d2ab32e1ac7b8b (diff) | |
download | openttd-cfda4bb38cd31f09df024f9d1f9c65178ebeb312.tar.xz |
(svn r2818) Don't tell the world about a local variable which is only used once
-rw-r--r-- | dedicated.c | 15 | ||||
-rw-r--r-- | variables.h | 1 |
2 files changed, 9 insertions, 7 deletions
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"); diff --git a/variables.h b/variables.h index 2872225e3..54be0e451 100644 --- a/variables.h +++ b/variables.h @@ -346,7 +346,6 @@ VARDEF char _savegame_format[8]; VARDEF char *_config_file; VARDEF char *_highscore_file; VARDEF char *_log_file; -VARDEF FILE *_log_file_fd; // NOSAVE: These can be recalculated from InitializeLandscapeVariables typedef struct { |