summaryrefslogtreecommitdiffstats
path: root/misc-utils/hardlink.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 19:33:30 +0000
commitc61e14d3a8412cd50d98aab604e607692c844c8a (patch)
tree4925aca0e6b64c8664ea2f3fdfa99a52dc93d5da /misc-utils/hardlink.c
parentAdding upstream version 2.39.3. (diff)
downloadutil-linux-c61e14d3a8412cd50d98aab604e607692c844c8a.tar.xz
util-linux-c61e14d3a8412cd50d98aab604e607692c844c8a.zip
Adding upstream version 2.40.upstream/2.40
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'misc-utils/hardlink.c')
-rw-r--r--misc-utils/hardlink.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/misc-utils/hardlink.c b/misc-utils/hardlink.c
index 7e66dfd..f9d3d09 100644
--- a/misc-utils/hardlink.c
+++ b/misc-utils/hardlink.c
@@ -991,7 +991,8 @@ static int is_reflink(struct file *xa, struct file *xb)
if (ioctl(bf, FS_IOC_FIEMAP, (unsigned long) bmap) < 0)
goto done;
- if (amap->fm_mapped_extents != bmap->fm_mapped_extents)
+ if (amap->fm_mapped_extents == 0 ||
+ amap->fm_mapped_extents != bmap->fm_mapped_extents)
goto done;
for (i = 0; i < amap->fm_mapped_extents; i++) {
@@ -1192,8 +1193,8 @@ static void __attribute__((__noreturn__)) usage(void)
fputs(_(" --skip-reflinks skip already cloned files (enabled on --reflink)\n"), out);
#endif
fputs(USAGE_SEPARATOR, out);
- printf(USAGE_HELP_OPTIONS(28));
- printf(USAGE_MAN_TAIL("hardlink(1)"));
+ fprintf(out, USAGE_HELP_OPTIONS(28));
+ fprintf(out, USAGE_MAN_TAIL("hardlink(1)"));
exit(EXIT_SUCCESS);
}