summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-05-27 17:22:46 +0200
committerLennart Poettering <lennart@poettering.net>2020-05-29 15:41:31 +0200
commitd197c403b2b71b6ab9b8cc9f3a171064b615018c (patch)
treefeead96b6349ad5dde5d2058fd9b6dec94b28f46
parentefi: as extra paranoia NUL terminate UTF-16 strings with three NUL bytes (diff)
downloadsystemd-d197c403b2b71b6ab9b8cc9f3a171064b615018c.tar.xz
systemd-d197c403b2b71b6ab9b8cc9f3a171064b615018c.zip
efi: explicitly update mtime of EFI variables when changing them
-rw-r--r--src/basic/efivars.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/basic/efivars.c b/src/basic/efivars.c
index 496b5d4d44..16982e4784 100644
--- a/src/basic/efivars.c
+++ b/src/basic/efivars.c
@@ -231,6 +231,14 @@ int efi_set_variable(
if (r < 0)
goto finish;
+ /* For some reason efivarfs doesn't update mtime automatically. Let's do it manually then. This is
+ * useful for processes that cache EFI variables to detect when changes occurred. */
+ if (futimens(fd, (struct timespec[2]) {
+ { .tv_nsec = UTIME_NOW },
+ { .tv_nsec = UTIME_NOW }
+ }) < 0)
+ log_debug_errno(errno, "Failed to update mtime/atime on %s, ignoring: %m", p);
+
r = 0;
finish: