Re: pg_read_file() with virtual files returns empty string

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: pg_read_file() with virtual files returns empty string
Date: 2020-07-04 17:50:03
Message-ID: cf1acbd8-90a0-9140-baec-28e2fbfa6e7e@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 7/4/20 1:10 PM, Joe Conway wrote:
> On 7/4/20 12:52 PM, Tom Lane wrote:
>> Justin Pryzby <pryzby(at)telsasoft(dot)com> writes:
>>> But I noticed that cfbot is now populating with failures like:
>>
>>> genfile.c: In function ‘read_binary_file’:
>>> genfile.c:192:5: error: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Werror=unused-result]
>>> fread(rbuf, 1, 1, file);
>>> ^
>>
>> Yeah, some of the pickier buildfarm members (eg spurfowl) are showing
>> that as a warning, too. Maybe make it like
>>
>> if (fread(rbuf, 1, 1, file) != 0 || !feof(file))
>> ereport(ERROR,
>>
>> Probably the feof test is redundant this way, but I'd be inclined to
>> leave it in anyhow.
>
> Ok, will fix. Thanks for the heads up.

And pushed -- thanks!

Joe
--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Juan José Santamaría Flecha 2020-07-04 19:17:52 Re: Postgres Windows build system doesn't work with python installed in Program Files
Previous Message Joe Conway 2020-07-04 17:10:25 Re: pg_read_file() with virtual files returns empty string