]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hardlink: add missing verbose messages and unify them
authorKarel Zak <kzak@redhat.com>
Thu, 31 Oct 2024 10:00:32 +0000 (11:00 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 31 Oct 2024 10:08:56 +0000 (11:08 +0100)
* use the concept of "Skipped (<reason>) <filename>" for all verbose  messages

* also add "Skipped" messages for the options --exclude and --exclude-subtree

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

index d789fa213069524ecf6d9ed992f6225b7be1261b..55e09265e1f79825989df9c881cd59da649b27a4 100644 (file)
@@ -856,8 +856,11 @@ static int inserter(const char *fpath, const struct stat *sb,
 #ifdef USE_SKIP_SUBTREE
        if (opts.exclude_subtree
            && typeflag == FTW_D
-           && match_any_regex(opts.exclude_subtree, fpath))
+           && match_any_regex(opts.exclude_subtree, fpath)) {
+               jlog(JLOG_VERBOSE1,
+                       _("Skipped (excluded subtree) %s"), fpath);
                return FTW_SKIP_SUBTREE;
+       }
 #endif
        if (typeflag != FTW_F || !S_ISREG(sb->st_mode))
                return 0;
@@ -866,14 +869,17 @@ static int inserter(const char *fpath, const struct stat *sb,
        excluded = match_any_regex(opts.exclude, fpath);
 
        if ((opts.exclude && excluded && !included) ||
-           (!opts.exclude && opts.include && !included))
+           (!opts.exclude && opts.include && !included)) {
+               jlog(JLOG_VERBOSE1,
+                       _("Skipped (excluded) %s"), fpath);
                return 0;
+       }
 
        stats.files++;
 
        if ((uintmax_t) sb->st_size < opts.min_size) {
                jlog(JLOG_VERBOSE1,
-                    _("Skipped %s (smaller than configured size)"), fpath);
+                    _("Skipped (smaller than configured size) %s"), fpath);
                return 0;
        }
 
@@ -883,7 +889,7 @@ static int inserter(const char *fpath, const struct stat *sb,
 
        if ((opts.max_size > 0) && ((uintmax_t) sb->st_size > opts.max_size)) {
                jlog(JLOG_VERBOSE1,
-                    _("Skipped %s (greater than configured size)"), fpath);
+                    _("Skipped (greater than configured size) %s"), fpath);
                return 0;
        }
 
@@ -912,7 +918,7 @@ static int inserter(const char *fpath, const struct stat *sb,
 
                if (has_fpath(*node, fpath)) {
                        jlog(JLOG_VERBOSE1,
-                               _("Skipped %s (specified more than once)"), fpath);
+                               _("Skipped (specified more than once) %s"), fpath);
                        free(fil->links);
                } else {
                        fil->links->next = (*node)->links;