git: 9b98c4b05391 - main - diff: handle read(2) failures
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 26 Mar 2026 09:26:28 UTC
The branch main has been updated by bapt:
URL: https://cgit.FreeBSD.org/src/commit/?id=9b98c4b053917cad42e26596b37df72efab6dc39
commit 9b98c4b053917cad42e26596b37df72efab6dc39
Author: Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2026-03-26 09:25:21 +0000
Commit: Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2026-03-26 09:25:50 +0000
diff: handle read(2) failures
MFC After: 1 week
---
usr.bin/diff/diffreg.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
index 8dcf55a7190b..5c1147bf2730 100644
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -542,6 +542,11 @@ opentemp(const char *f)
return (NULL);
}
}
+ if (nread == -1) {
+ close(ifd);
+ close(ofd);
+ return (NULL);
+ }
close(ifd);
lseek(ofd, (off_t)0, SEEK_SET);
return (fdopen(ofd, "r"));