Re: Check return value of pclose() correctly

2022-11-15 Thread Peter Eisentraut
On 02.11.22 16:26, Ankit Kumar Pandey wrote: The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, passed Spec compliant: tested, passed Documentation:tested, passed Hi Peter, This

Re: Check return value of pclose() correctly

2022-11-08 Thread Peter Eisentraut
invalid output. More important is that something like pg_upgrade does check the exit status when it calls pg_controldata etc. That's what this patch accomplishes. From 86b2b61d30f848b84c69437c7106dea8fdf3738d Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 8 Nov 2022 14:

Re: Check return value of pclose() correctly

2022-11-02 Thread Ankit Kumar Pandey
The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, passed Spec compliant: tested, passed Documentation:tested, passed Hi Peter, This is a review of the pclose return value check p

Re: Check return value of pclose() correctly

2022-11-01 Thread Peter Eisentraut
On 01.11.22 06:52, Tom Lane wrote: I think there are two issues here. POSIX says Upon successful return, pclose() shall return the termination status of the command language interpreter. Otherwise, pclose() shall return -1 and set errno to indicate the error. That is, first you

Re: Check return value of pclose() correctly

2022-11-01 Thread Peter Eisentraut
On 01.11.22 06:35, Michael Paquier wrote: - if (WIFEXITED(exitstatus)) + if (exitstatus == -1) + { + snprintf(str, sizeof(str), "%m"); + } This addition in wait_result_to_str() looks inconsistent with the existing callers of pclose() and ClosePipeStream() that check for -1 as exit s

Re: Check return value of pclose() correctly

2022-10-31 Thread Tom Lane
Michael Paquier writes: > On Mon, Oct 31, 2022 at 09:12:53AM +0100, Peter Eisentraut wrote: >> (A failure to run the command issued by popen() is usually reported via the >> pclose() status, so while you can often get away with not checking fclose() >> or close(), checking pclose() is more often u

Re: Check return value of pclose() correctly

2022-10-31 Thread Michael Paquier
On Mon, Oct 31, 2022 at 09:12:53AM +0100, Peter Eisentraut wrote: > I noticed that some (not all) callers didn't check the return value of > pclose() or ClosePipeStream() correctly. Either they didn't check it at all > or they treated it like the return of fclose(). Here is a patch with fixes. >

Check return value of pclose() correctly

2022-10-31 Thread Peter Eisentraut
on Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 31 Oct 2022 09:04:45 +0100 Subject: [PATCH v1] Check return value of pclose() correctly Some callers didn't check the return value of pclose() or ClosePipeStream() correctly. Either they didn't check it at all or they treated it