Re: Clean up some signal usage mainly related to Windows

From: "Tristan Partin" <tristan(at)neon(dot)tech>
To: "Peter Eisentraut" <peter(at)eisentraut(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Clean up some signal usage mainly related to Windows
Date: 2023-07-12 14:23:06
Message-ID: CU09F7WY18HM.I8WTXS84NTDK@gonk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed Jul 12, 2023 at 3:56 AM CDT, Peter Eisentraut wrote:
> On 06.07.23 22:43, Tristan Partin wrote:
> > /* Finish incomplete line on stdout */
> > - puts("");
> > - exit(1);
> > + write(STDOUT_FILENO, "", 1);
> > + _exit(1);
>
> puts() writes a newline, so it should probably be something like
>
> write(STDOUT_FILENO, "\n", 1);

Silly mistake. Thanks. v2 attached.

It has come to my attention that STDOUT_FILENO might not be portable and
fileno(3) isn't marked as signal-safe, so I have just used the raw 1 for
stdout, which as far as I know is portable.

--
Tristan Partin
Neon (https://neon.tech)

Attachment Content-Type Size
v2-0002-Cleanup-some-signal-usage-on-Windows.patch text/x-patch 4.2 KB
v2-0001-Use-signal-safe-functions-in-signal-handler.patch text/x-patch 1.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2023-07-12 14:29:26 Re: tablecmds.c/MergeAttributes() cleanup
Previous Message Önder Kalacı 2023-07-12 14:15:17 Re: doc: improve the restriction description of using indexes on REPLICA IDENTITY FULL table.