From 688b311f5c6c0b20a3811f6a135bf87e11f36502 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 1 Jun 2021 17:40:51 +0200 Subject: [PATCH] various: don't say that the timestamp 'changed' on initial load I always found this a bit annoying. With the patch: $ SYSTEMD_LOG_LEVEL=debug build/udevadm test /sys/class/block/dm-1 ... Loaded timestamp for '/etc/systemd/network'. Loaded timestamp for '/usr/lib/systemd/network'. Parsed configuration file /usr/lib/systemd/network/99-default.link Parsed configuration file /etc/systemd/network/10-eth0.link Created link configuration context. Loaded timestamp for '/etc/udev/rules.d'. Loaded timestamp for '/usr/lib/udev/rules.d'. ... (cherry picked from commit 0d5a24beaedb161d4f7fe07361d2a5abdbd6e736) --- src/basic/path-util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/basic/path-util.c b/src/basic/path-util.c index 50ba44492e..15bb45da0a 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -682,7 +682,7 @@ int find_executable_full(const char *name, bool use_path_envvar, char **ret_file } bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool update) { - bool changed = false; + bool changed = false, originally_unset; const char* const* i; assert(timestamp); @@ -690,6 +690,8 @@ bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool upd if (!paths) return false; + originally_unset = *timestamp == 0; + STRV_FOREACH(i, paths) { struct stat stats; usec_t u; @@ -699,11 +701,11 @@ bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool upd u = timespec_load(&stats.st_mtim); - /* first check */ + /* check first */ if (*timestamp >= u) continue; - log_debug("timestamp of '%s' changed", *i); + log_debug(originally_unset ? "Loaded timestamp for '%s'." : "Timestamp of '%s' changed.", *i); /* update timestamp */ if (update) { -- 2.25.1