public inbox for [email protected]  
help / color / mirror / Atom feed
From: Justin Pryzby <[email protected]>
To: Michael Paquier <[email protected]>
Cc: Bharath Rupireddy <[email protected]>
Cc: David Christensen <[email protected]>
Cc: Ian Lawrence Barwick <[email protected]>
Cc: Matthias van de Meent <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL
Date: Mon, 26 Dec 2022 14:39:03 -0600
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAOxo6XLhduEAn0yLh+BGOjpq6k0x9MsOY6PjDEoCh4VvdUxCiQ@mail.gmail.com>
	<CALj2ACWmgbDeCDMaZah0GRwQBCJMD01U4S69V6TE4W2jYmnLuQ@mail.gmail.com>
	<CAOxo6XJMcLyLb1D4oOV2FHfJvt1Z6DuediGUKKEHAEMvpPe2ow@mail.gmail.com>
	<[email protected]>
	<CAOxo6X+NCVAB3H5_TMSasgimf127KURoi=S0dTSNJUn8Z8+WNA@mail.gmail.com>
	<CALj2ACUT+DB8PhF6ja8f-LP76cEappXrJuhzrKd81a90UmrnYA@mail.gmail.com>
	<CAOxo6XLhKqiacFPSo2BhZU6Qwwy3wDEsVjPmTsgHz9Pr-aVyUg@mail.gmail.com>
	<CAOxo6XJyYZdiEsF5r3+h1BSPprQ6+8=a4EgNiePWQjyFaafdZw@mail.gmail.com>
	<CALj2ACVwNiSNKFjZ+Wr2a+Wwqt9ELCQeFXTWNqf8s8eOZSd7Ew@mail.gmail.com>
	<[email protected]>

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





view thread (55+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox