From 161d3fd6c62167d3cd5f6e255648ba7391c28eb4 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 13 Dec 2021 13:34:42 +0100 Subject: [PATCH] findmnt: (verify) add hint about systemctl daemon-reload Let's inform that systemd uses stuff older than fstab. Signed-off-by: Karel Zak --- misc-utils/findmnt-verify.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/misc-utils/findmnt-verify.c b/misc-utils/findmnt-verify.c index 164c6589ba..1577aa9937 100644 --- a/misc-utils/findmnt-verify.c +++ b/misc-utils/findmnt-verify.c @@ -14,6 +14,7 @@ #include "c.h" #include "strutils.h" #include "xalloc.h" +#include "pathnames.h" #include "findmnt.h" @@ -35,7 +36,7 @@ struct verify_context { static void __attribute__ ((__format__ (__printf__, 3, 0))) verify_mesg(struct verify_context *vfy, char type, const char *fmt, va_list ap) { - if (!vfy->target_printed) { + if (!vfy->target_printed && vfy->fs) { fprintf(stdout, "%s\n", mnt_fs_get_target(vfy->fs)); vfy->target_printed = 1; } @@ -545,6 +546,19 @@ int verify_table(struct libmnt_table *tb) flags |= FL_NOSWAPMATCH; } +#ifdef USE_SYSTEMD + { + struct stat a, b; + + if (stat(_PATH_SD_UNITSLOAD, &a) == 0 && + stat(_PATH_MNTTAB, &b) == 0 && + cmp_stat_mtime(&a, &b, <)) + verify_warn(&vfy, _( + "your fstab has been modified, but systemd still uses the old version;\n" + " use 'systemctl daemon-reload' to reload")); + } +#endif + done: mnt_free_iter(itr); -- 2.47.3