]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
findmnt: (verify) add hint about systemctl daemon-reload
authorKarel Zak <kzak@redhat.com>
Mon, 13 Dec 2021 12:34:42 +0000 (13:34 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 13 Dec 2021 12:34:42 +0000 (13:34 +0100)
Let's inform that systemd uses stuff older than fstab.

Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/findmnt-verify.c

index 164c6589ba658a7fa09347d0dc98c3bfe7dd7701..1577aa993759142094eb3422ab86ef5e59c87902 100644 (file)
@@ -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);