We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c99e91b commit f6dcd54Copy full SHA for f6dcd54
Modules/posixmodule.c
@@ -8060,9 +8060,21 @@ os_posix_openpt_impl(PyObject *module, int oflag)
8060
{
8061
int fd;
8062
8063
+#if defined(O_CLOEXEC)
8064
+ oflag |= O_CLOEXEC;
8065
+#endif
8066
+
8067
fd = posix_openpt(oflag);
- if (fd == -1)
8068
+ if (fd == -1) {
8069
posix_error();
8070
+ return -1;
8071
+ }
8072
8073
+ // Just in case, likely a no-op given O_CLOEXEC above.
8074
+ if (_Py_set_inheritable(fd, 0, NULL) < 0) {
8075
+ close(fd);
8076
8077
8078
8079
return fd;
8080
}
0 commit comments