From 893839b119880d3fe8ab18aba4563af6c80cb875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Mon, 23 Dec 2024 18:15:57 +0100 Subject: [PATCH] diff: Fix device case. We already fell back to Stone for FIFOs, but we actually need to fall back to Stone for everything except regular files, because libdiff's atomizer needs to know the size of its input in advance, and neither FIFOs nor devices can be trusted to report their size. MFC after: 1 week Reported by: mav Reviewed by: mav, allanjude Differential Revision: https://reviews.freebsd.org/D48181 --- usr.bin/diff/diffreg_new.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/diff/diffreg_new.c b/usr.bin/diff/diffreg_new.c index af9104559986a1..f54cd554ccade8 100644 --- a/usr.bin/diff/diffreg_new.c +++ b/usr.bin/diff/diffreg_new.c @@ -314,8 +314,8 @@ openfile(const char *path, char **p, struct stat *st) bool can_libdiff(int flags) { - /* We can't use fifos with libdiff yet */ - if (S_ISFIFO(stb1.st_mode) || S_ISFIFO(stb2.st_mode)) + /* libdiff's atomizer can only deal with files */ + if (!S_ISREG(stb1.st_mode) || !S_ISREG(stb2.st_mode)) return false; /* Is this one of the supported input/output modes for diffreg_new? */