aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
diff options
context:
space:
mode:
authorJoe Conway <mail@joeconway.com>2020-07-04 13:47:31 -0400
committerJoe Conway <mail@joeconway.com>2020-07-04 13:47:31 -0400
commit1243aa9b2f2e8a23f5fbace2b038b962bf79e9f0 (patch)
treee977e269484706ab844c2b67e9c2f5d5291431d5 /src/backend/utils/adt
parentc2cdaf0cb912fa24ac56170c7c47a2fc398e2516 (diff)
downloadpostgresql-1243aa9b2f2e8a23f5fbace2b038b962bf79e9f0.tar.gz
postgresql-1243aa9b2f2e8a23f5fbace2b038b962bf79e9f0.zip
Fix "ignoring return value" complaints from commit 96d1f423f9
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
Diffstat (limited to 'src/backend/utils/adt')
-rw-r--r--src/backend/utils/adt/genfile.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c
index 37e90d2302a..2f6aba78b7e 100644
--- a/src/backend/utils/adt/genfile.c
+++ b/src/backend/utils/adt/genfile.c
@@ -165,8 +165,7 @@ read_binary_file(const char *filename, int64 seek_offset, int64 bytes_to_read,
{
char rbuf[1];
- fread(rbuf, 1, 1, file);
- if (!feof(file))
+ if (fread(rbuf, 1, 1, file) != 0 || !feof(file))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("file length too large")));