]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hardlink: add verbose messages when skip file
authorKarel Zak <kzak@redhat.com>
Fri, 12 Nov 2021 10:50:41 +0000 (11:50 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 12 Nov 2021 10:50:41 +0000 (11:50 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/hardlink.c

index b1ba70c680204421d652efadbd09f38766b9ec83..7c11f644a5c4d31256adf85781bdc11e5a649768 100644 (file)
@@ -850,9 +850,15 @@ static void visitor(const void *nodep, const VISIT which, const int depth)
                        assert(other != other->next);
                        assert(other->st.st_size == master->st.st_size);
 
+                       if (!other->links)
+                               continue;
+
                        /* check file attributes, etc. */
-                       if (!other->links || !file_may_link_to(master, other))
+                       if (!file_may_link_to(master, other)) {
+                               jlog(JLOG_VERBOSE2,
+                                    _("Skipped (attributes mismatch) %s"), other->links->path);
                                continue;
+                       }
 
                        /* initialize content comparison */
                        if (!ul_fileeq_data_associated(&master->data))
@@ -868,8 +874,11 @@ static void visitor(const void *nodep, const VISIT which, const int depth)
 
                        stats.comparisons++;
 
-                       if (!eq)
+                       if (!eq) {
+                               jlog(JLOG_VERBOSE2,
+                                    _("Skipped (content mismatch) %s"), other->links->path);
                                continue;
+                       }
 
                        /* link files */
                        if (!file_link(master, other) && errno == EMLINK) {