]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #16048 from poettering/conf-parser-mtime
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 2 Jun 2020 23:25:28 +0000 (08:25 +0900)
committerGitHub <noreply@github.com>
Tue, 2 Jun 2020 23:25:28 +0000 (08:25 +0900)
conf-parser: automatically pick up newest mtime when parsing configuration files

1  2 
src/core/load-fragment.c

diff --combined src/core/load-fragment.c
index a24c7877f900926da521b5615549479750a5d7a6,780692ce0eb2d4cfd8daee3baae7948775ead26a..49fdcaff7e14f573db5d34ab0f296d9f7b404529
@@@ -4804,6 -4804,7 +4804,6 @@@ static int merge_by_names(Unit **u, Se
  int unit_load_fragment(Unit *u) {
          const char *fragment;
          _cleanup_set_free_free_ Set *names = NULL;
 -        struct stat st;
          int r;
  
          assert(u);
          if (fragment) {
                  /* Open the file, check if this is a mask, otherwise read. */
                  _cleanup_fclose_ FILE *f = NULL;
 +                struct stat st;
  
                  /* Try to open the file name. A symlink is OK, for example for linked files or masks. We
                   * expect that all symlinks within the lookup paths have been already resolved, but we don't
                          r = config_parse(u->id, fragment, f,
                                           UNIT_VTABLE(u)->sections,
                                           config_item_perf_lookup, load_fragment_gperf_lookup,
-                                          CONFIG_PARSE_ALLOW_INCLUDE, u);
+                                          CONFIG_PARSE_ALLOW_INCLUDE,
+                                          u,
+                                          NULL);
                          if (r == -ENOEXEC)
                                  log_unit_notice_errno(u, r, "Unit configuration has fatal error, unit will not be started.");
                          if (r < 0)
                  }
          }
  
 -        if (u->source_path) {
 -                if (stat(u->source_path, &st) >= 0)
 -                        u->source_mtime = timespec_load(&st.st_mtim);
 -                else
 -                        u->source_mtime = 0;
 -        }
 -
          /* We do the merge dance here because for some unit types, the unit might have aliases which are not
           * declared in the file system. In particular, this is true (and frequent) for device and swap units.
           */