Skip to content

Commit

Permalink
diff: Fix device case.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dag-erling committed Dec 23, 2024
1 parent b45f84c commit 893839b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions usr.bin/diff/diffreg_new.c
Original file line number Diff line number Diff line change
Expand Up @@ -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? */
Expand Down

0 comments on commit 893839b

Please sign in to comment.