@@ -541,7 +541,7 @@ child_exec(char *const exec_array[],
541
541
int close_fds , int restore_signals ,
542
542
int call_setsid , pid_t pgid_to_set ,
543
543
gid_t gid ,
544
- Py_ssize_t groups_size , const gid_t * groups ,
544
+ Py_ssize_t extra_group_size , const gid_t * extra_groups ,
545
545
uid_t uid , int child_umask ,
546
546
const void * child_sigmask ,
547
547
PyObject * py_fds_to_keep ,
@@ -641,8 +641,8 @@ child_exec(char *const exec_array[],
641
641
#endif
642
642
643
643
#ifdef HAVE_SETGROUPS
644
- if (groups_size > 0 )
645
- POSIX_CALL (setgroups (groups_size , groups ));
644
+ if (extra_group_size > 0 )
645
+ POSIX_CALL (setgroups (extra_group_size , extra_groups ));
646
646
#endif /* HAVE_SETGROUPS */
647
647
648
648
#ifdef HAVE_SETREGID
@@ -747,7 +747,7 @@ do_fork_exec(char *const exec_array[],
747
747
int close_fds , int restore_signals ,
748
748
int call_setsid , pid_t pgid_to_set ,
749
749
gid_t gid ,
750
- Py_ssize_t groups_size , const gid_t * groups ,
750
+ Py_ssize_t extra_group_size , const gid_t * extra_groups ,
751
751
uid_t uid , int child_umask ,
752
752
const void * child_sigmask ,
753
753
PyObject * py_fds_to_keep ,
@@ -762,7 +762,7 @@ do_fork_exec(char *const exec_array[],
762
762
/* These are checked by our caller; verify them in debug builds. */
763
763
assert (uid == (uid_t )- 1 );
764
764
assert (gid == (gid_t )- 1 );
765
- assert (groups_size < 0 );
765
+ assert (extra_group_size < 0 );
766
766
assert (preexec_fn == Py_None );
767
767
768
768
pid = vfork ();
@@ -799,7 +799,7 @@ do_fork_exec(char *const exec_array[],
799
799
p2cread , p2cwrite , c2pread , c2pwrite ,
800
800
errread , errwrite , errpipe_read , errpipe_write ,
801
801
close_fds , restore_signals , call_setsid , pgid_to_set ,
802
- gid , groups_size , groups ,
802
+ gid , extra_group_size , extra_groups ,
803
803
uid , child_umask , child_sigmask ,
804
804
py_fds_to_keep , preexec_fn , preexec_fn_args_tuple );
805
805
_exit (255 );
@@ -826,7 +826,7 @@ _posixsubprocess.fork_exec as subprocess_fork_exec
826
826
call_setsid: bool
827
827
pgid_to_set: pid_t
828
828
gid as gid_object: object
829
- groups_list : object
829
+ extra_groups as extra_groups_packed : object
830
830
uid as uid_object: object
831
831
child_umask: int
832
832
preexec_fn: object
@@ -865,19 +865,19 @@ subprocess_fork_exec_impl(PyObject *module, PyObject *process_args,
865
865
int errwrite , int errpipe_read , int errpipe_write ,
866
866
int restore_signals , int call_setsid ,
867
867
pid_t pgid_to_set , PyObject * gid_object ,
868
- PyObject * groups_list , PyObject * uid_object ,
869
- int child_umask , PyObject * preexec_fn ,
870
- int allow_vfork )
871
- /*[clinic end generated code: output=7c8ff5a6dc92af1b input=c59d1152ecdffcf9 ]*/
868
+ PyObject * extra_groups_packed ,
869
+ PyObject * uid_object , int child_umask ,
870
+ PyObject * preexec_fn , int allow_vfork )
871
+ /*[clinic end generated code: output=7ee4f6ee5cf22b5b input=51757287ef266ffa ]*/
872
872
{
873
873
PyObject * converted_args = NULL , * fast_args = NULL ;
874
874
PyObject * preexec_fn_args_tuple = NULL ;
875
- gid_t * groups = NULL ;
875
+ gid_t * extra_groups = NULL ;
876
876
PyObject * cwd_obj2 = NULL ;
877
877
const char * cwd = NULL ;
878
878
int need_to_reenable_gc = 0 ;
879
879
char * const * argv = NULL , * const * envp = NULL ;
880
- Py_ssize_t num_groups = 0 ;
880
+ Py_ssize_t extra_group_size = 0 ;
881
881
int need_after_fork = 0 ;
882
882
int saved_errno = 0 ;
883
883
@@ -951,41 +951,41 @@ subprocess_fork_exec_impl(PyObject *module, PyObject *process_args,
951
951
cwd = PyBytes_AsString (cwd_obj2 );
952
952
}
953
953
954
- if (groups_list != Py_None ) {
954
+ if (extra_groups_packed != Py_None ) {
955
955
#ifdef HAVE_SETGROUPS
956
- if (!PyList_Check (groups_list )) {
956
+ if (!PyList_Check (extra_groups_packed )) {
957
957
PyErr_SetString (PyExc_TypeError ,
958
958
"setgroups argument must be a list" );
959
959
goto cleanup ;
960
960
}
961
- num_groups = PySequence_Size (groups_list );
961
+ extra_group_size = PySequence_Size (extra_groups_packed );
962
962
963
- if (num_groups < 0 )
963
+ if (extra_group_size < 0 )
964
964
goto cleanup ;
965
965
966
- if (num_groups > MAX_GROUPS ) {
967
- PyErr_SetString (PyExc_ValueError , "too many groups " );
966
+ if (extra_group_size > MAX_GROUPS ) {
967
+ PyErr_SetString (PyExc_ValueError , "too many extra_groups " );
968
968
goto cleanup ;
969
969
}
970
970
971
- /* Deliberately keep groups == NULL for num_groups == 0 */
972
- if (num_groups > 0 ) {
973
- groups = PyMem_RawMalloc (num_groups * sizeof (gid_t ));
974
- if (groups == NULL ) {
971
+ /* Deliberately keep extra_groups == NULL for extra_group_size == 0 */
972
+ if (extra_group_size > 0 ) {
973
+ extra_groups = PyMem_RawMalloc (extra_group_size * sizeof (gid_t ));
974
+ if (extra_groups == NULL ) {
975
975
PyErr_SetString (PyExc_MemoryError ,
976
976
"failed to allocate memory for group list" );
977
977
goto cleanup ;
978
978
}
979
979
}
980
980
981
- for (Py_ssize_t i = 0 ; i < num_groups ; i ++ ) {
981
+ for (Py_ssize_t i = 0 ; i < extra_group_size ; i ++ ) {
982
982
PyObject * elem ;
983
- elem = PySequence_GetItem (groups_list , i );
983
+ elem = PySequence_GetItem (extra_groups_packed , i );
984
984
if (!elem )
985
985
goto cleanup ;
986
986
if (!PyLong_Check (elem )) {
987
987
PyErr_SetString (PyExc_TypeError ,
988
- "groups must be integers" );
988
+ "extra_groups must be integers" );
989
989
Py_DECREF (elem );
990
990
goto cleanup ;
991
991
} else {
@@ -995,7 +995,7 @@ subprocess_fork_exec_impl(PyObject *module, PyObject *process_args,
995
995
PyErr_SetString (PyExc_ValueError , "invalid group id" );
996
996
goto cleanup ;
997
997
}
998
- groups [i ] = gid ;
998
+ extra_groups [i ] = gid ;
999
999
}
1000
1000
Py_DECREF (elem );
1001
1001
}
@@ -1047,7 +1047,7 @@ subprocess_fork_exec_impl(PyObject *module, PyObject *process_args,
1047
1047
/* Use vfork() only if it's safe. See the comment above child_exec(). */
1048
1048
sigset_t old_sigs ;
1049
1049
if (preexec_fn == Py_None && allow_vfork &&
1050
- uid == (uid_t )- 1 && gid == (gid_t )- 1 && num_groups < 0 ) {
1050
+ uid == (uid_t )- 1 && gid == (gid_t )- 1 && extra_group_size < 0 ) {
1051
1051
/* Block all signals to ensure that no signal handlers are run in the
1052
1052
* child process while it shares memory with us. Note that signals
1053
1053
* used internally by C libraries won't be blocked by
@@ -1070,7 +1070,7 @@ subprocess_fork_exec_impl(PyObject *module, PyObject *process_args,
1070
1070
p2cread , p2cwrite , c2pread , c2pwrite ,
1071
1071
errread , errwrite , errpipe_read , errpipe_write ,
1072
1072
close_fds , restore_signals , call_setsid , pgid_to_set ,
1073
- gid , num_groups , groups ,
1073
+ gid , extra_group_size , extra_groups ,
1074
1074
uid , child_umask , old_sigmask ,
1075
1075
py_fds_to_keep , preexec_fn , preexec_fn_args_tuple );
1076
1076
@@ -1110,7 +1110,7 @@ subprocess_fork_exec_impl(PyObject *module, PyObject *process_args,
1110
1110
}
1111
1111
1112
1112
Py_XDECREF (preexec_fn_args_tuple );
1113
- PyMem_RawFree (groups );
1113
+ PyMem_RawFree (extra_groups );
1114
1114
Py_XDECREF (cwd_obj2 );
1115
1115
if (envp )
1116
1116
_Py_FreeCharPArray (envp );
0 commit comments