mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-01-18 04:58:51 +02:00
Check return value of getsockopt().
Checking the return value is not terribly important here, but if setsockopt() fails it is likely that bind() will fail as well. May as well get it over with and this makes Coverity happy.
This commit is contained in:
parent
1152f7a7d6
commit
13d4559708
@ -164,7 +164,10 @@
|
||||
|
||||
<release-development-list>
|
||||
<release-item>
|
||||
<github-pull-request id="1504"/>
|
||||
<commit subject="Add TLS server.">
|
||||
<github-pull-request id="1504"/>
|
||||
</commit>
|
||||
<commit subject="Check return value of getsockopt()."/>
|
||||
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="david.steele"/>
|
||||
|
@ -176,7 +176,10 @@ sckServerNew(const String *const address, const unsigned int port, const TimeMSe
|
||||
|
||||
// Set the address as reusable so we can bind again quickly after a restart or crash
|
||||
int reuseAddr = 1;
|
||||
setsockopt(driver->socket, SOL_SOCKET, SO_REUSEADDR, &reuseAddr, sizeof(reuseAddr));
|
||||
|
||||
THROW_ON_SYS_ERROR(
|
||||
setsockopt(driver->socket, SOL_SOCKET, SO_REUSEADDR, &reuseAddr, sizeof(reuseAddr)) == -1, ProtocolError,
|
||||
"unable to set SO_REUSEADDR");
|
||||
|
||||
// Ensure file descriptor is closed
|
||||
memContextCallbackSet(driver->memContext, sckServerFreeResource, driver);
|
||||
|
Loading…
x
Reference in New Issue
Block a user