Skip to content

Commit

Permalink
native: Throw any error from dup/dup2
Browse files Browse the repository at this point in the history
  • Loading branch information
kohlschuetter committed Feb 4, 2024
1 parent 41d5d08 commit eba1d2c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions junixsocket-native/src/main/c/filedescriptors.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,10 @@ JNIEXPORT jobject JNICALL Java_org_newsclub_net_unix_NativeUnixSocket_duplicate
} else {
targetFD = dup2(sourceFD, targetFD);
}
if(targetFD == -1) {
_throwErrnumException(env, errno, NULL);
return NULL;
}

if (targetFD >= 0) {
# if defined(FD_CLOEXEC)
Expand Down

0 comments on commit eba1d2c

Please sign in to comment.