Skip to content

Commit 085fba5

Browse files
committed
Add warning when errfds is not a subset of readfds & writefds
1 parent 1105d3a commit 085fba5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/EmulatedPosixSupport.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,22 @@ public int[] pipeMessage() throws PosixException {
424424
public SelectResult select(int[] readfds, int[] writefds, int[] errorfds, Timeval timeout) throws PosixException {
425425
SelectableChannel[] readChannels = getSelectableChannels(readfds);
426426
SelectableChannel[] writeChannels = getSelectableChannels(writefds);
427-
// Java doesn't support any exceptional conditions we could apply on errfds
428-
// TODO raise exception if errfds is not a subset of readfds & writefds?
427+
// Java doesn't support any exceptional conditions we could apply on errfds, report a
428+
// warning if errfds is not a subset of readfds & writefds
429+
errfdsCheck: for (int fd : errorfds) {
430+
for (int fd2 : readfds) {
431+
if (fd == fd2) {
432+
continue errfdsCheck;
433+
}
434+
}
435+
for (int fd2 : writefds) {
436+
if (fd == fd2) {
437+
continue errfdsCheck;
438+
}
439+
}
440+
compatibilityIgnored("POSIX emultaion layer doesn't support waiting on exceptional conditions in select()");
441+
break;
442+
}
429443

430444
boolean[] wasBlocking = new boolean[readChannels.length + writeChannels.length];
431445
int i = 0;

0 commit comments

Comments
 (0)