]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pid1: clarify that min_max is always initialized
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 27 Nov 2017 22:01:48 +0000 (22:01 +0000)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 28 Nov 2017 08:26:14 +0000 (09:26 +0100)
read_one_line_file() always returns <= 0, so the code was OK, but let's write
the check a bit differently to make it obvious that min_max is always set.

src/core/main.c

index d77946194c1e9caa4ec60ae140a7a7052ba2b679..b7fb9b3524948e7871acd8e289e284c3fbb8fbfe 100644 (file)
@@ -1237,7 +1237,7 @@ static int bump_rlimit_nofile(struct rlimit *saved_rlimit) {
 
         /* Get current RLIMIT_NOFILE maximum compiled into the kernel. */
         r = read_one_line_file("/proc/sys/fs/nr_open", &nr_open);
-        if (r == 0)
+        if (r >= 0)
                 r = safe_atoi(nr_open, &min_max);
         /* If we fail, fallback to the hard-coded kernel limit of 1024 * 1024. */
         if (r < 0)