Skip to content

Commit

Permalink
Skip SCTP event initialization if the protocol is not supported
Browse files Browse the repository at this point in the history
We may not want to actually use SCTP after all, and if we do, we won't
get to use the uninitialized subscribe struct anyway.  Thus aborting
handle initialization is premature here.
  • Loading branch information
wferi committed Dec 28, 2018
1 parent fab8857 commit 4706aba
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libknet/transport_sctp.c
Expand Up @@ -1322,6 +1322,10 @@ static int _sctp_subscribe_init(knet_handle_t knet_h)

test_socket = socket(PF_INET, SOCK_STREAM, IPPROTO_SCTP);
if (test_socket < 0) {
if (errno == EPROTONOSUPPORT) {
log_debug(knet_h, KNET_SUB_TRANSP_SCTP, "SCTP not supported, skipping initialization");
return 0;
}
savederrno = errno;
log_err(knet_h, KNET_SUB_TRANSP_SCTP, "Unable to create test socket: %s",
strerror(savederrno));
Expand Down

0 comments on commit 4706aba

Please sign in to comment.