Skip to content

Commit 1243aa9

Browse files
committed
Fix "ignoring return value" complaints from commit 96d1f42
The cfbot and some BF animals are complaining about the previous read_binary_file commit because of ignoring return value of ‘fread’. So let's make everyone happy by testing the return value even though not strictly needed. Reported by Justin Pryzby, and suggested patch by Tom Lane. Backpatched to v11 same as the previous commit. Reported-By: Justin Pryzby Reviewed-By: Tom Lane Discussion: https://postgr.es/m/flat/969b8d82-5bb2-5fa8-4eb1-f0e685c5d736%40joeconway.com Backpatch-through: 11
1 parent c2cdaf0 commit 1243aa9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/backend/utils/adt/genfile.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ read_binary_file(const char *filename, int64 seek_offset, int64 bytes_to_read,
165165
{
166166
char rbuf[1];
167167

168-
fread(rbuf, 1, 1, file);
169-
if (!feof(file))
168+
if (fread(rbuf, 1, 1, file) != 0 || !feof(file))
170169
ereport(ERROR,
171170
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
172171
errmsg("file length too large")));

0 commit comments

Comments
 (0)