Skip to content

Commit 9dad34c

Browse files
committed
gh-124621: Emscripten: Fix __syscall_ioctl patch
If there is an error, we have to return `-errno` not positive errno. Included in backport of GH-136931: #136988
1 parent c933a6b commit 9dad34c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Python/emscripten_syscalls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ int __syscall_ioctl(int fd, int request, void* varargs) {
302302
int flags = fcntl(fd, F_GETFL, 0);
303303
int nonblock = **((int**)varargs);
304304
if (flags < 0) {
305-
return errno;
305+
return -errno;
306306
}
307307
if (nonblock) {
308308
flags |= O_NONBLOCK;
@@ -311,7 +311,7 @@ int __syscall_ioctl(int fd, int request, void* varargs) {
311311
}
312312
int res = fcntl(fd, F_SETFL, flags);
313313
if (res < 0) {
314-
return errno;
314+
return -errno;
315315
}
316316
return res;
317317
}

0 commit comments

Comments
 (0)