git: 0c0e08be01a7 - stable/15 - diff: handle read(2) failures
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Apr 2026 16:52:21 UTC
The branch stable/15 has been updated by bapt:
URL: https://cgit.FreeBSD.org/src/commit/?id=0c0e08be01a755061eff1f85e7f8bed966fbe0bf
commit 0c0e08be01a755061eff1f85e7f8bed966fbe0bf
Author: Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2026-03-26 09:25:21 +0000
Commit: Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2026-04-06 16:51:46 +0000
diff: handle read(2) failures
MFC After: 1 week
(cherry picked from commit 9b98c4b053917cad42e26596b37df72efab6dc39)
---
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"));