git: 893839b11988 - main - diff: Fix device case.

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Mon, 23 Dec 2024 17:16:17 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=893839b119880d3fe8ab18aba4563af6c80cb875

commit 893839b119880d3fe8ab18aba4563af6c80cb875
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2024-12-23 17:15:57 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2024-12-23 17:16:14 +0000

    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 af9104559986..f54cd554ccad 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? */