Magellan Linux

Annotation of /trunk/systemd/patches/systemd-242-core-set-fs.file-max-sysctl-to-LONG_MAX-rather-than-ULONG_MAX.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3368 - (hide annotations) (download)
Tue Jul 9 11:20:22 2019 UTC (4 years, 11 months ago) by niro
File size: 1343 byte(s)
-added systemd-242 upstream patches
1 niro 3368 From 6e2f78948403a4cce45b9e34311c9577c624f066 Mon Sep 17 00:00:00 2001
2     From: Lennart Poettering <lennart@poettering.net>
3     Date: Mon, 17 Jun 2019 10:51:25 +0200
4     Subject: [PATCH] core: set fs.file-max sysctl to LONG_MAX rather than
5     ULONG_MAX
6    
7     Since kernel 5.2 the kernel thankfully returns proper errors when we
8     write a value out of range to the sysctl. Which however breaks writing
9     ULONG_MAX to request the maximum value. Hence let's write the new
10     maximum value instead, LONG_MAX.
11    
12     /cc @brauner
13    
14     Fixes: #12803
15     ---
16     src/core/main.c | 6 +++---
17     1 file changed, 3 insertions(+), 3 deletions(-)
18    
19     diff --git a/src/core/main.c b/src/core/main.c
20     index b33ea1b5b52..e7f51815f07 100644
21     --- a/src/core/main.c
22     +++ b/src/core/main.c
23     @@ -1245,9 +1245,9 @@ static void bump_file_max_and_nr_open(void) {
24     #endif
25    
26     #if BUMP_PROC_SYS_FS_FILE_MAX
27     - /* I so wanted to use STRINGIFY(ULONG_MAX) here, but alas we can't as glibc/gcc define that as
28     - * "(0x7fffffffffffffffL * 2UL + 1UL)". Seriously. 😢 */
29     - if (asprintf(&t, "%lu\n", ULONG_MAX) < 0) {
30     + /* The maximum the kernel allows for this since 5.2 is LONG_MAX, use that. (Previously thing where
31     + * different but the operation would fail silently.) */
32     + if (asprintf(&t, "%li\n", LONG_MAX) < 0) {
33     log_oom();
34     return;
35     }