From bf5f83907ffae516e6ece2d8b8fe166a9c632852 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Mon, 16 May 2022 19:21:36 +0430 Subject: Ports: Update freeciv's patches to use git patches --- ...to-dev-null-if-the-log-file-doesn-t-exist.patch | 54 ++++++++++++++++++++++ Ports/freeciv/patches/ReadMe.md | 7 +++ Ports/freeciv/patches/log.patch | 41 ---------------- 3 files changed, 61 insertions(+), 41 deletions(-) create mode 100644 Ports/freeciv/patches/0001-Log-to-dev-null-if-the-log-file-doesn-t-exist.patch create mode 100644 Ports/freeciv/patches/ReadMe.md delete mode 100644 Ports/freeciv/patches/log.patch (limited to 'Ports/freeciv/patches') diff --git a/Ports/freeciv/patches/0001-Log-to-dev-null-if-the-log-file-doesn-t-exist.patch b/Ports/freeciv/patches/0001-Log-to-dev-null-if-the-log-file-doesn-t-exist.patch new file mode 100644 index 0000000000..6a8ca189ef --- /dev/null +++ b/Ports/freeciv/patches/0001-Log-to-dev-null-if-the-log-file-doesn-t-exist.patch @@ -0,0 +1,54 @@ +From cbcb5538e52f9990387d4d79e676d6ef3d03fe46 Mon Sep 17 00:00:00 2001 +From: Gunnar Beutner +Date: Fri, 4 Jun 2021 23:20:55 +0200 +Subject: [PATCH] Log to /dev/null if the log file doesn't exist + +--- + client/connectdlg_common.c | 22 ++++++++++++++-------- + 1 file changed, 14 insertions(+), 8 deletions(-) + +diff --git a/client/connectdlg_common.c b/client/connectdlg_common.c +index 0afef96..d931378 100644 +--- a/client/connectdlg_common.c ++++ b/client/connectdlg_common.c +@@ -302,6 +302,7 @@ bool client_start_server(void) + char dbg_lvl_buf[32]; /* Do not move this inside the block where it gets filled, + * it's needed via the argv[x] pointer later on, so must + * remain in scope. */ ++ bool log_to_dev_null = FALSE; + + /* Set up the command-line parameters. */ + fc_snprintf(port_buf, sizeof(port_buf), "%d", internal_server_port); +@@ -376,16 +377,21 @@ bool client_start_server(void) + fclose(stdout); + fclose(stderr); + +- /* FIXME: include the port to avoid duplication? */ +- if (logfile) { ++ if (!logfile) { ++ log_to_dev_null = TRUE; ++ fd = open("/dev/null", O_WRONLY); ++ } else { ++ /* FIXME: include the port to avoid duplication? */ + fd = open(logfile, O_WRONLY | O_CREAT | O_APPEND, 0644); ++ } + +- if (fd != 1) { +- dup2(fd, 1); +- } +- if (fd != 2) { +- dup2(fd, 2); +- } ++ if (fd != 1) { ++ dup2(fd, 1); ++ } ++ if (fd != 2) { ++ dup2(fd, 2); ++ } ++ if (!log_to_dev_null) { + fchmod(1, 0644); + } + +-- +2.36.1 + diff --git a/Ports/freeciv/patches/ReadMe.md b/Ports/freeciv/patches/ReadMe.md new file mode 100644 index 0000000000..286ff85f45 --- /dev/null +++ b/Ports/freeciv/patches/ReadMe.md @@ -0,0 +1,7 @@ +# Patches for freeciv on SerenityOS + +## `0001-Log-to-dev-null-if-the-log-file-doesn-t-exist.patch` + +Log to /dev/null if the log file doesn't exist + + diff --git a/Ports/freeciv/patches/log.patch b/Ports/freeciv/patches/log.patch deleted file mode 100644 index 7498018fd1..0000000000 --- a/Ports/freeciv/patches/log.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff -Naur freeciv-3.0.0-beta2/client/connectdlg_common.c freeciv-3.0.0-beta2.serenity/client/connectdlg_common.c ---- freeciv-3.0.0-beta2/client/connectdlg_common.c 2021-05-14 12:36:45.000000000 +0200 -+++ freeciv-3.0.0-beta2.serenity/client/connectdlg_common.c 2021-06-05 00:22:43.151395241 +0200 -@@ -302,6 +302,7 @@ - char dbg_lvl_buf[32]; /* Do not move this inside the block where it gets filled, - * it's needed via the argv[x] pointer later on, so must - * remain in scope. */ -+ bool log_to_dev_null = FALSE; - - /* Set up the command-line parameters. */ - fc_snprintf(port_buf, sizeof(port_buf), "%d", internal_server_port); -@@ -376,16 +377,21 @@ - fclose(stdout); - fclose(stderr); - -- /* FIXME: include the port to avoid duplication? */ -- if (logfile) { -+ if (!logfile) { -+ log_to_dev_null = TRUE; -+ fd = open("/dev/null", O_WRONLY); -+ } else { -+ /* FIXME: include the port to avoid duplication? */ - fd = open(logfile, O_WRONLY | O_CREAT | O_APPEND, 0644); -+ } - -- if (fd != 1) { -- dup2(fd, 1); -- } -- if (fd != 2) { -- dup2(fd, 2); -- } -+ if (fd != 1) { -+ dup2(fd, 1); -+ } -+ if (fd != 2) { -+ dup2(fd, 2); -+ } -+ if (!log_to_dev_null) { - fchmod(1, 0644); - } - -- cgit v1.2.3