]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysctl: no need to check for eof twice
authorLennart Poettering <lennart@poettering.net>
Tue, 25 Oct 2016 07:26:31 +0000 (09:26 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 2 Nov 2016 17:29:59 +0000 (11:29 -0600)
Let's only check for eof once after the fgets(). There's no point in checking
EOF before the first read, and twice in each loop.

src/sysctl/sysctl.c

index 7117955568095e2d80c26370d3e6753f8a605e77..cce91b3d679a72cc2273423f25dda970987a424f 100644 (file)
@@ -104,7 +104,7 @@ static int parse_file(OrderedHashmap *sysctl_options, const char *path, bool ign
         }
 
         log_debug("Parsing %s", path);
-        while (!feof(f)) {
+        for (;;) {
                 char l[LINE_MAX], *p, *value, *new_value, *property, *existing;
                 void *v;
                 int k;