@@ -519,7 +519,7 @@ child_exec(char *const exec_array[],
519
519
int close_fds , int restore_signals ,
520
520
int call_setsid , pid_t pgid_to_set ,
521
521
gid_t gid ,
522
- Py_ssize_t groups_size , const gid_t * groups ,
522
+ Py_ssize_t extra_group_size , const gid_t * extra_groups ,
523
523
uid_t uid , int child_umask ,
524
524
const void * child_sigmask ,
525
525
PyObject * py_fds_to_keep ,
@@ -619,8 +619,8 @@ child_exec(char *const exec_array[],
619
619
#endif
620
620
621
621
#ifdef HAVE_SETGROUPS
622
- if (groups_size > 0 )
623
- POSIX_CALL (setgroups (groups_size , groups ));
622
+ if (extra_group_size > 0 )
623
+ POSIX_CALL (setgroups (extra_group_size , extra_groups ));
624
624
#endif /* HAVE_SETGROUPS */
625
625
626
626
#ifdef HAVE_SETREGID
@@ -725,7 +725,7 @@ do_fork_exec(char *const exec_array[],
725
725
int close_fds , int restore_signals ,
726
726
int call_setsid , pid_t pgid_to_set ,
727
727
gid_t gid ,
728
- Py_ssize_t groups_size , const gid_t * groups ,
728
+ Py_ssize_t extra_group_size , const gid_t * extra_groups ,
729
729
uid_t uid , int child_umask ,
730
730
const void * child_sigmask ,
731
731
PyObject * py_fds_to_keep ,
@@ -740,7 +740,7 @@ do_fork_exec(char *const exec_array[],
740
740
/* These are checked by our caller; verify them in debug builds. */
741
741
assert (uid == (uid_t )- 1 );
742
742
assert (gid == (gid_t )- 1 );
743
- assert (groups_size < 0 );
743
+ assert (extra_group_size < 0 );
744
744
assert (preexec_fn == Py_None );
745
745
746
746
pid = vfork ();
@@ -777,7 +777,7 @@ do_fork_exec(char *const exec_array[],
777
777
p2cread , p2cwrite , c2pread , c2pwrite ,
778
778
errread , errwrite , errpipe_read , errpipe_write ,
779
779
close_fds , restore_signals , call_setsid , pgid_to_set ,
780
- gid , groups_size , groups ,
780
+ gid , extra_group_size , extra_groups ,
781
781
uid , child_umask , child_sigmask ,
782
782
py_fds_to_keep , preexec_fn , preexec_fn_args_tuple );
783
783
_exit (255 );
@@ -793,20 +793,20 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
793
793
PyObject * env_list , * preexec_fn ;
794
794
PyObject * process_args , * converted_args = NULL , * fast_args = NULL ;
795
795
PyObject * preexec_fn_args_tuple = NULL ;
796
- PyObject * groups_list ;
796
+ PyObject * extra_groups_packed ;
797
797
PyObject * uid_object , * gid_object ;
798
798
int p2cread , p2cwrite , c2pread , c2pwrite , errread , errwrite ;
799
799
int errpipe_read , errpipe_write , close_fds , restore_signals ;
800
800
int call_setsid ;
801
801
pid_t pgid_to_set = -1 ;
802
- gid_t * groups = NULL ;
802
+ gid_t * extra_groups = NULL ;
803
803
int child_umask ;
804
804
PyObject * cwd_obj , * cwd_obj2 = NULL ;
805
805
const char * cwd ;
806
806
pid_t pid = -1 ;
807
807
int need_to_reenable_gc = 0 ;
808
808
char * const * exec_array , * const * argv = NULL , * const * envp = NULL ;
809
- Py_ssize_t arg_num , num_groups = 0 ;
809
+ Py_ssize_t arg_num , extra_group_size = 0 ;
810
810
int need_after_fork = 0 ;
811
811
int saved_errno = 0 ;
812
812
int allow_vfork ;
@@ -819,7 +819,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
819
819
& p2cread , & p2cwrite , & c2pread , & c2pwrite ,
820
820
& errread , & errwrite , & errpipe_read , & errpipe_write ,
821
821
& restore_signals , & call_setsid , & pgid_to_set ,
822
- & gid_object , & groups_list , & uid_object , & child_umask ,
822
+ & gid_object , & extra_groups_packed , & uid_object , & child_umask ,
823
823
& preexec_fn , & allow_vfork ))
824
824
return NULL ;
825
825
@@ -895,41 +895,41 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
895
895
cwd = NULL ;
896
896
}
897
897
898
- if (groups_list != Py_None ) {
898
+ if (extra_groups_packed != Py_None ) {
899
899
#ifdef HAVE_SETGROUPS
900
- if (!PyList_Check (groups_list )) {
900
+ if (!PyList_Check (extra_groups_packed )) {
901
901
PyErr_SetString (PyExc_TypeError ,
902
902
"setgroups argument must be a list" );
903
903
goto cleanup ;
904
904
}
905
- num_groups = PySequence_Size (groups_list );
905
+ extra_group_size = PySequence_Size (extra_groups_packed );
906
906
907
- if (num_groups < 0 )
907
+ if (extra_group_size < 0 )
908
908
goto cleanup ;
909
909
910
- if (num_groups > MAX_GROUPS ) {
911
- PyErr_SetString (PyExc_ValueError , "too many groups " );
910
+ if (extra_group_size > MAX_GROUPS ) {
911
+ PyErr_SetString (PyExc_ValueError , "too many extra_groups " );
912
912
goto cleanup ;
913
913
}
914
914
915
- /* Deliberately keep groups == NULL for num_groups == 0 */
916
- if (num_groups > 0 ) {
917
- groups = PyMem_RawMalloc (num_groups * sizeof (gid_t ));
918
- if (groups == NULL ) {
915
+ /* Deliberately keep extra_groups == NULL for extra_group_size == 0 */
916
+ if (extra_group_size > 0 ) {
917
+ extra_groups = PyMem_RawMalloc (extra_group_size * sizeof (gid_t ));
918
+ if (extra_groups == NULL ) {
919
919
PyErr_SetString (PyExc_MemoryError ,
920
920
"failed to allocate memory for group list" );
921
921
goto cleanup ;
922
922
}
923
923
}
924
924
925
- for (Py_ssize_t i = 0 ; i < num_groups ; i ++ ) {
925
+ for (Py_ssize_t i = 0 ; i < extra_group_size ; i ++ ) {
926
926
PyObject * elem ;
927
- elem = PySequence_GetItem (groups_list , i );
927
+ elem = PySequence_GetItem (extra_groups_packed , i );
928
928
if (!elem )
929
929
goto cleanup ;
930
930
if (!PyLong_Check (elem )) {
931
931
PyErr_SetString (PyExc_TypeError ,
932
- "groups must be integers" );
932
+ "extra_groups must be integers" );
933
933
Py_DECREF (elem );
934
934
goto cleanup ;
935
935
} else {
@@ -939,7 +939,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
939
939
PyErr_SetString (PyExc_ValueError , "invalid group id" );
940
940
goto cleanup ;
941
941
}
942
- groups [i ] = gid ;
942
+ extra_groups [i ] = gid ;
943
943
}
944
944
Py_DECREF (elem );
945
945
}
@@ -991,7 +991,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
991
991
/* Use vfork() only if it's safe. See the comment above child_exec(). */
992
992
sigset_t old_sigs ;
993
993
if (preexec_fn == Py_None && allow_vfork &&
994
- uid == (uid_t )- 1 && gid == (gid_t )- 1 && num_groups < 0 ) {
994
+ uid == (uid_t )- 1 && gid == (gid_t )- 1 && extra_group_size < 0 ) {
995
995
/* Block all signals to ensure that no signal handlers are run in the
996
996
* child process while it shares memory with us. Note that signals
997
997
* used internally by C libraries won't be blocked by
@@ -1014,7 +1014,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
1014
1014
p2cread , p2cwrite , c2pread , c2pwrite ,
1015
1015
errread , errwrite , errpipe_read , errpipe_write ,
1016
1016
close_fds , restore_signals , call_setsid , pgid_to_set ,
1017
- gid , num_groups , groups ,
1017
+ gid , extra_group_size , extra_groups ,
1018
1018
uid , child_umask , old_sigmask ,
1019
1019
py_fds_to_keep , preexec_fn , preexec_fn_args_tuple );
1020
1020
@@ -1054,7 +1054,7 @@ subprocess_fork_exec(PyObject *module, PyObject *args)
1054
1054
}
1055
1055
1056
1056
Py_XDECREF (preexec_fn_args_tuple );
1057
- PyMem_RawFree (groups );
1057
+ PyMem_RawFree (extra_groups );
1058
1058
Py_XDECREF (cwd_obj2 );
1059
1059
if (envp )
1060
1060
_Py_FreeCharPArray (envp );
@@ -1079,7 +1079,7 @@ PyDoc_STRVAR(subprocess_fork_exec_doc,
1079
1079
p2cread, p2cwrite, c2pread, c2pwrite,\n\
1080
1080
errread, errwrite, errpipe_read, errpipe_write,\n\
1081
1081
restore_signals, call_setsid, pgid_to_set,\n\
1082
- gid, groups_list , uid,\n\
1082
+ gid, extra_groups , uid,\n\
1083
1083
preexec_fn)\n\
1084
1084
\n\
1085
1085
Forks a child process, closes parent file descriptors as appropriate in the\n\
0 commit comments