Update to 15.0-beta1

This commit is contained in:
dP
2024-12-25 20:34:06 +05:00
parent 46dc456049
commit a86fd7c621
963 changed files with 38070 additions and 33798 deletions

View File

@@ -11,8 +11,8 @@
#include "fileio_func.h"
#include "debug.h"
std::string _log_file; ///< File to reroute output of a forked OpenTTD to
std::unique_ptr<FILE, FileDeleter> _log_fd; ///< File to reroute output of a forked OpenTTD to
std::string _log_file; ///< Filename to reroute output of a forked OpenTTD to
std::optional<FileHandle> _log_fd; ///< File to reroute output of a forked OpenTTD to
#if defined(UNIX)
@@ -31,17 +31,17 @@ void DedicatedFork()
case 0: { // We're the child
/* Open the log-file to log all stuff too */
_log_fd.reset(fopen(_log_file.c_str(), "a"));
if (!_log_fd) {
_log_fd = FileHandle::Open(_log_file, "a");
if (!_log_fd.has_value()) {
perror("Unable to open logfile");
exit(1);
}
/* Redirect stdout and stderr to log-file */
if (dup2(fileno(_log_fd.get()), fileno(stdout)) == -1) {
if (dup2(fileno(*_log_fd), fileno(stdout)) == -1) {
perror("Rerouting stdout");
exit(1);
}
if (dup2(fileno(_log_fd.get()), fileno(stderr)) == -1) {
if (dup2(fileno(*_log_fd), fileno(stderr)) == -1) {
perror("Rerouting stderr");
exit(1);
}