summaryrefslogtreecommitdiff
path: root/src/shared/path-util.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2013-10-29 15:15:53 +0100
committerTom Gundersen <teg@jklm.no>2013-10-29 16:12:11 +0100
commit97f2d76d4f4dfab8b0629c09926a05a1e5621125 (patch)
tree3b6042e8487f4b02bc7dc74233dd9f65b5bd1801 /src/shared/path-util.c
parentdabfa9d1efd0d1a7e0507d69f9789bc6404ff786 (diff)
path_check_timestamp: only keep the most recent timestamp
There is no point in keeping one timestamp for each directory, as we only ever care about the most recent one.
Diffstat (limited to 'src/shared/path-util.c')
-rw-r--r--src/shared/path-util.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/shared/path-util.c b/src/shared/path-util.c
index def7a7409a..fcacf541ed 100644
--- a/src/shared/path-util.c
+++ b/src/shared/path-util.c
@@ -474,11 +474,13 @@ int find_binary(const char *name, char **filename) {
}
}
-bool paths_check_timestamp(char **paths, usec_t *paths_ts_usec, bool update)
+bool paths_check_timestamp(char **paths, usec_t *timestamp, bool update)
{
unsigned int i;
bool changed = false;
+ assert(timestamp);
+
if (paths == NULL)
goto out;
@@ -488,18 +490,16 @@ bool paths_check_timestamp(char **paths, usec_t *paths_ts_usec, bool update)
if (stat(paths[i], &stats) < 0)
continue;
- if (paths_ts_usec[i] == timespec_load(&stats.st_mtim))
+ /* first check */
+ if (*timestamp >= timespec_load(&stats.st_mtim))
continue;
- /* first check */
- if (paths_ts_usec[i] != 0) {
- log_debug("reload - timestamp of '%s' changed\n", paths[i]);
- changed = true;
- }
+ log_debug("timestamp of '%s' changed\n", paths[i]);
+ changed = true;
/* update timestamp */
if (update)
- paths_ts_usec[i] = timespec_load(&stats.st_mtim);
+ *timestamp = timespec_load(&stats.st_mtim);
}
out:
return changed;