Compare commits

...

3 Commits

Author SHA1 Message Date
Michael Paquier
6b14404b0b seg: Add test "security" in meson.build
Oversight in 681d9e4621aa where the test has been added.

Reported-by: Justin Pryzby
Discussion: https://postgr.es/m/ZK5AgYxG4zLErD5O@telsasoft.com
Backpatch-through: 16
2024-01-18 10:12:51 +09:00
Heikki Linnakangas
4cf9ef670e Fix incorrect comment on how BackendStatusArray is indexed
The comment was copy-pasted from the call to ProcSignalInit() in
AuxiliaryProcessMain(), which uses a similar scheme of having reserved
slots for aux processes after MaxBackends slots for backends. However,
ProcSignalInit() indexing starts from 1, whereas BackendStatusArray
starts from 0. The code is correct, but the comment was wrong.

Discussion: https://www.postgresql.org/message-id/f3ecd4cb-85ee-4e54-8278-5fabfb3a4ed0@iki.fi
Backpatch-through: v14
2024-01-17 15:45:51 +02:00
Daniel Gustafsson
6614d38d87 Close socket in case of errors in setting non-blocking
If configuring the newly created socket non-blocking fails we
error out and return INVALID_SOCKET, but the socket that had
been created wasn't closed. Fix by issuing closesocket in the
errorpath.

Backpatch to all supported branches.

Author: Ranier Vilela <ranier.vf@gmail.com>
Discussion: https://postgr.es/m/CAEudQApmU5CrKefH85VbNYE2y8H=-qqEJbg6RAPU65+vCe+89A@mail.gmail.com
Backpatch-through: v12
2024-01-17 11:24:11 +01:00
3 changed files with 5 additions and 3 deletions

View File

@ -53,6 +53,7 @@ tests += {
'bd': meson.current_build_dir(), 'bd': meson.current_build_dir(),
'regress': { 'regress': {
'sql': [ 'sql': [
'security',
'seg', 'seg',
], ],
}, },

View File

@ -303,6 +303,7 @@ pgwin32_socket(int af, int type, int protocol)
if (ioctlsocket(s, FIONBIO, &on)) if (ioctlsocket(s, FIONBIO, &on))
{ {
TranslateSocketError(); TranslateSocketError();
closesocket(s);
return INVALID_SOCKET; return INVALID_SOCKET;
} }
errno = 0; errno = 0;

View File

@ -263,9 +263,9 @@ pgstat_beinit(void)
* Assign the MyBEEntry for an auxiliary process. Since it doesn't * Assign the MyBEEntry for an auxiliary process. Since it doesn't
* have a BackendId, the slot is statically allocated based on the * have a BackendId, the slot is statically allocated based on the
* auxiliary process type (MyAuxProcType). Backends use slots indexed * auxiliary process type (MyAuxProcType). Backends use slots indexed
* in the range from 1 to MaxBackends (inclusive), so we use * in the range from 0 to MaxBackends (exclusive), so we use
* MaxBackends + AuxBackendType + 1 as the index of the slot for an * MaxBackends + AuxProcType as the index of the slot for an auxiliary
* auxiliary process. * process.
*/ */
MyBEEntry = &BackendStatusArray[MaxBackends + MyAuxProcType]; MyBEEntry = &BackendStatusArray[MaxBackends + MyAuxProcType];
} }