summaryrefslogtreecommitdiffstats
path: root/debian/patches/core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-ULONG.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 02:25:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 02:25:51 +0000
commitac8399db6ce846597966360732ce6d39a247bdd2 (patch)
tree046a28d2cbd02afa147291e8f69e9bb5dc29f1aa /debian/patches/core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-ULONG.patch
parentAdding upstream version 241. (diff)
downloadsystemd-ac8399db6ce846597966360732ce6d39a247bdd2.tar.xz
systemd-ac8399db6ce846597966360732ce6d39a247bdd2.zip
Adding debian version 241-7~deb10u8.debian/241-7_deb10u8debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-ULONG.patch')
-rw-r--r--debian/patches/core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-ULONG.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/debian/patches/core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-ULONG.patch b/debian/patches/core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-ULONG.patch
new file mode 100644
index 0000000..6465a1f
--- /dev/null
+++ b/debian/patches/core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-ULONG.patch
@@ -0,0 +1,34 @@
+From: Lennart Poettering <lennart@poettering.net>
+Date: Mon, 17 Jun 2019 10:51:25 +0200
+Subject: core: set fs.file-max sysctl to LONG_MAX rather than ULONG_MAX
+
+Since kernel 5.2 the kernel thankfully returns proper errors when we
+write a value out of range to the sysctl. Which however breaks writing
+ULONG_MAX to request the maximum value. Hence let's write the new
+maximum value instead, LONG_MAX.
+
+/cc @brauner
+
+Fixes: #12803
+(cherry picked from commit 6e2f78948403a4cce45b9e34311c9577c624f066)
+---
+ src/core/main.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/main.c b/src/core/main.c
+index bc7fcc6..255e204 100644
+--- a/src/core/main.c
++++ b/src/core/main.c
+@@ -1200,9 +1200,9 @@ static void bump_file_max_and_nr_open(void) {
+ #endif
+
+ #if BUMP_PROC_SYS_FS_FILE_MAX
+- /* I so wanted to use STRINGIFY(ULONG_MAX) here, but alas we can't as glibc/gcc define that as
+- * "(0x7fffffffffffffffL * 2UL + 1UL)". Seriously. 😢 */
+- if (asprintf(&t, "%lu\n", ULONG_MAX) < 0) {
++ /* The maximum the kernel allows for this since 5.2 is LONG_MAX, use that. (Previously thing where
++ * different but the operation would fail silently.) */
++ if (asprintf(&t, "%li\n", LONG_MAX) < 0) {
+ log_oom();
+ return;
+ }