Skip to content

Commit

Permalink
8267938: (sctp) SCTP channel factory methods should check platform su…
Browse files Browse the repository at this point in the history
…pport

Backport-of: bd31653
  • Loading branch information
theaoqi authored and Paul Hohensee committed Mar 7, 2024
1 parent f3069d1 commit 7b7fbdf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/jdk.sctp/unix/native/libsctp/SctpNet.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -190,7 +190,13 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpNet_socket0
fd = socket(domain, (oneToOne ? SOCK_STREAM : SOCK_SEQPACKET), IPPROTO_SCTP);

if (fd < 0) {
return handleSocketError(env, errno);
if (errno == EPROTONOSUPPORT || errno == ESOCKTNOSUPPORT) {
JNU_ThrowByNameWithLastError(env, "java/lang/UnsupportedOperationException",
"Protocol not supported");
return IOS_THROWN;
} else {
return handleSocketError(env, errno);
}
}

/* Enable events */
Expand Down

1 comment on commit 7b7fbdf

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.