Set fSocket to -1 after close on an error to prevent a double close.

Signed-off-by: Joe Yasi <joe.yasi@gmail.com>
This commit is contained in:
Joseph A. Yasi 2019-06-19 00:35:35 -04:00 committed by Filipe Coelho
parent a24777a16c
commit dad4b57027
1 changed files with 2 additions and 0 deletions

View File

@ -137,6 +137,7 @@ int JackClientSocket::Connect(const char* dir, const char* name, int which) // A
if (connect(fSocket, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
jack_error("Cannot connect to server socket err = %s", strerror(errno));
close(fSocket);
fSocket = -1;
return -1;
}
@ -297,6 +298,7 @@ int JackServerSocket::Bind(const char* dir, const char* name, int which) // A re
error:
unlink(fName);
close(fSocket);
fSocket = -1;
return -1;
}