dcavalca / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
1ff636
From f98f6ed9a27871cd2ce505b977ba8c2390e104b6 Mon Sep 17 00:00:00 2001
1ff636
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
1ff636
Date: Tue, 14 Apr 2015 20:47:20 -0500
1ff636
Subject: [PATCH] systemctl: avoid bumping NOFILE rlimit unless needed
1ff636
1ff636
We actually only use the journal when showing status. Move setrlimit call
1ff636
so it is only called for status.
1ff636
1ff636
https://bugzilla.redhat.com/show_bug.cgi?id=1184712
1ff636
(cherry picked from commit 40acc203c043fd419f3c045dc6f116c3a28411d8)
1ff636
1ff636
Cherry-picked from: e87fa61
1ff636
Resolves: #1222517
1ff636
---
1ff636
 src/systemctl/systemctl.c | 11 ++++++-----
1ff636
 1 file changed, 6 insertions(+), 5 deletions(-)
1ff636
1ff636
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
c62b8e
index 4ec0cff21d..089c25f83f 100644
1ff636
--- a/src/systemctl/systemctl.c
1ff636
+++ b/src/systemctl/systemctl.c
1ff636
@@ -4449,6 +4449,12 @@ static int show(sd_bus *bus, char **args) {
1ff636
         if (show_properties)
1ff636
                 pager_open_if_enabled();
1ff636
 
1ff636
+        if (show_status)
1ff636
+                /* Increase max number of open files to 16K if we can, we
1ff636
+                 * might needs this when browsing journal files, which might
1ff636
+                 * be split up into many files. */
1ff636
+                setrlimit_closest(RLIMIT_NOFILE, &RLIMIT_MAKE_CONST(16384));
1ff636
+
1ff636
         /* If no argument is specified inspect the manager itself */
1ff636
 
1ff636
         if (show_properties && strv_length(args) <= 1)
1ff636
@@ -7207,11 +7213,6 @@ found:
1ff636
                 }
1ff636
         }
1ff636
 
1ff636
-        /* Increase max number of open files to 16K if we can, we
1ff636
-         * might needs this when browsing journal files, which might
1ff636
-         * be split up into many files. */
1ff636
-        setrlimit_closest(RLIMIT_NOFILE, &RLIMIT_MAKE_CONST(16384));
1ff636
-
1ff636
         return verb->dispatch(bus, argv + optind);
1ff636
 }
1ff636