Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL
Date
Msg-id 20221226203903.GT1153@telsasoft.com
Whole thread Raw
In response to Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL  (Michael Paquier <michael@paquier.xyz>)
Responses Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Mon, Dec 26, 2022 at 04:28:52PM +0900, Michael Paquier wrote:
> Comments?

> +        file = fopen(filename, PG_BINARY_W);
> +        if (!file)
> +            pg_fatal("could not open file \"%s\": %m", filename);
> +
> +        if (fwrite(page, BLCKSZ, 1, file) != 1)
> +            pg_fatal("could not write file \"%s\": %m", filename);
> +
> +        fclose(file);

fclose() should be tested, too:

> +        if (fwrite(page, BLCKSZ, 1, file) != 1 || fclose(file) != 0)
> +            pg_fatal("could not write file \"%s\": %m", filename);

-- 
Justin



pgsql-hackers by date:

Previous
From: David Christensen
Date:
Subject: Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL
Next
From: Peter Geoghegan
Date:
Subject: Re: New strategies for freezing, advancing relfrozenxid early