summaryrefslogtreecommitdiff
path: root/src/core/main.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-12-03 11:55:55 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-12-03 11:59:03 +0100
commita5fac1df2743e6407b23d22dbcbf7a25deddbb5c (patch)
treefa427a86b1def9b83dfde395bfdc88fb13bb6536 /src/core/main.c
parentb47e0fac0356308cf34aa235ba9328c0c9de51bd (diff)
downloadsystemd-a5fac1df2743e6407b23d22dbcbf7a25deddbb5c.tar.gz
manager: define a string constant for LONG_MAX and use that for sysctl
This moves the formatting of the constant to compilation time and let's us avoid asprintf() in the very hot path of initial boot.
Diffstat (limited to 'src/core/main.c')
-rw-r--r--src/core/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/main.c b/src/core/main.c
index ffe5c1688a..df83a1d2d4 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1184,7 +1184,7 @@ static void bump_file_max_and_nr_open(void) {
#if BUMP_PROC_SYS_FS_FILE_MAX
/* The maximum the kernel allows for this since 5.2 is LONG_MAX, use that. (Previously things were
* different, but the operation would fail silently.) */
- r = sysctl_writef("fs/file-max", "%li", LONG_MAX);
+ r = sysctl_write("fs/file-max", LONG_MAX_STR);
if (r < 0)
log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING,
r, "Failed to bump fs.file-max, ignoring: %m");