8000 fix fileutils · python/cpython@ef6f457 · GitHub
[go: up one dir, main page]

Skip to content

Commit ef6f457

Browse files
fix fileutils
1 parent 2463bbd commit ef6f457

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

Modules/socketmodule.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5401,8 +5401,7 @@ sock_initobj_impl(PySocketSockObject *self, int family, int type, int proto,
54015401

54025402
#ifndef MS_WINDOWS
54035403
#ifdef SOCK_CLOEXEC
5404-
int cloexec_works = GET_SOCK_CLOEXEC_WORKS();
5405-
int *atomic_flag_works = &cloexec_works;
5404+
int *atomic_flag_works = &sock_cloexec_works;
54065405
#else
54075406
int *atomic_flag_works = NULL;
54085407
#endif
@@ -6307,8 +6306,7 @@ socket_socketpair(PyObject *self, PyObject *args)
63076306
PyObject *res = NULL;
63086307
socket_state *state = get_module_state(self);
63096308
#ifdef SOCK_CLOEXEC
6310-
int cloexec_works = GET_SOCK_CLOEXEC_WORKS();
6311-
int *atomic_flag_works = &cloexec_works;
6309+
int *atomic_flag_works = &sock_cloexec_works;
63126310
#else
63136311
int *atomic_flag_works = NULL;
63146312
#endif

Python/fileutils.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,14 +1468,14 @@ set_inheritable(int fd, int inheritable, int raise, int *atomic_flag_works)
14681468
assert(!(atomic_flag_works != NULL && inheritable));
14691469

14701470
if (atomic_flag_works != NULL && !inheritable) {
1471-
if (*atomic_flag_works == -1) {
1471+
if (_Py_atomic_load_int_relaxed(atomic_flag_works) == -1) {
14721472
int isInheritable = get_inheritable(fd, raise);
14731473
if (isInheritable == -1)
14741474
return -1;
1475-
*atomic_flag_works = !isInheritable;
1475+
_Py_atomic_store_int_relaxed(atomic_flag_works, !isInheritable);
14761476
}
14771477

1478-
if (*atomic_flag_works)
1478+
if (_Py_atomic_load_int_relaxed(atomic_flag_works))
14791479
return 0;
14801480
}
14811481

0 commit comments

Comments
 (0)
0