]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: avoid bumping NOFILE rlimit unless needed
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 15 Apr 2015 01:47:20 +0000 (20:47 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 15 Apr 2015 01:47:20 +0000 (21:47 -0400)
We actually only use the journal when showing status. Move setrlimit call
so it is only called for status.

https://bugzilla.redhat.com/show_bug.cgi?id=1184712

src/systemctl/systemctl.c

index 75d709d317e203df2586e6a7c4c780822ae293a7..4e702fb8bc13f09bf6422b2cdbf896dad70e803d 100644 (file)
@@ -4466,6 +4466,12 @@ static int show(sd_bus *bus, char **args) {
         if (show_properties)
                 pager_open_if_enabled();
 
+        if (show_status)
+                /* Increase max number of open files to 16K if we can, we
+                 * might needs this when browsing journal files, which might
+                 * be split up into many files. */
+                setrlimit_closest(RLIMIT_NOFILE, &RLIMIT_MAKE_CONST(16384));
+
         /* If no argument is specified inspect the manager itself */
 
         if (show_properties && strv_length(args) <= 1)
@@ -7164,11 +7170,6 @@ found:
                 }
         }
 
-        /* Increase max number of open files to 16K if we can, we
-         * might needs this when browsing journal files, which might
-         * be split up into many files. */
-        setrlimit_closest(RLIMIT_NOFILE, &RLIMIT_MAKE_CONST(16384));
-
         return verb->dispatch(bus, argv + optind);
 }