GUAC-1171: Handle socket() error return values.

This commit is contained in:
Michael Jumper 2015-07-12 22:22:32 -07:00
parent c6191f4539
commit 3eac35c158

View File

@ -374,6 +374,11 @@ guac_common_ssh_session* guac_common_ssh_create_session(guac_client* client,
/* Get socket */ /* Get socket */
fd = socket(AF_INET, SOCK_STREAM, 0); fd = socket(AF_INET, SOCK_STREAM, 0);
if (fd < 0) {
guac_client_abort(client, GUAC_PROTOCOL_STATUS_SERVER_ERROR,
"Unable to create socket: %s", strerror(errno));
return NULL;
}
/* Get addresses connection */ /* Get addresses connection */
if ((retval = getaddrinfo(hostname, port, &hints, &addresses))) { if ((retval = getaddrinfo(hostname, port, &hints, &addresses))) {