]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
conf-parser: remove unused condition
authorMike Yuan <me@yhndnzj.com>
Mon, 13 Nov 2023 09:08:24 +0000 (17:08 +0800)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 13 Nov 2023 10:32:38 +0000 (10:32 +0000)
Follow-up for 9ac2f3c4d2cc02eda32034980461c21232bb746c

config_parse() returns 0 only on ENOENT, which can
never happen since we pass the FILE stream.

src/shared/conf-parser.c

index f552e9aed2fc05a0ba2ddebff4c1bf3a62446774..12312f550084695a3f341519db4e53e17d68f90c 100644 (file)
@@ -564,14 +564,12 @@ static int config_parse_many_files(
                 r = config_parse(NULL, *fn, f, sections, lookup, table, flags, userdata, &st);
                 if (r < 0)
                         return r;
-                if (r > 0) {
-                        if (ret_stats_by_path) {
-                                r = hashmap_put_stats_by_path(&stats_by_path, *fn, &st);
-                                if (r < 0)
-                                        return r;
-                        }
+                assert(r > 0);
 
-                        break;
+                if (ret_stats_by_path) {
+                        r = hashmap_put_stats_by_path(&stats_by_path, *fn, &st);
+                        if (r < 0)
+                                return r;
                 }
         }
 
@@ -583,8 +581,7 @@ static int config_parse_many_files(
                 r = config_parse(NULL, path_dropin, f_dropin, sections, lookup, table, flags, userdata, &st);
                 if (r < 0)
                         return r;
-                if (r == 0)
-                        continue;
+                assert(r > 0);
 
                 if (ret_stats_by_path) {
                         r = hashmap_put_stats_by_path(&stats_by_path, path_dropin, &st);