@@ -5177,10 +5177,16 @@ enum posix_spawn_file_actions_identifier {
5177
5177
POSIX_SPAWN_DUP2
5178
5178
};
5179
5179
5180
+ #if defined(__GLIBC__ ) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ < 20 ))
5180
5181
static int
5181
5182
parse_file_actions (PyObject * file_actions ,
5182
5183
posix_spawn_file_actions_t * file_actionsp ,
5183
5184
PyObject * temp_buffer )
5185
+ #else
5186
+ static int
5187
+ parse_file_actions (PyObject * file_actions ,
5188
+ posix_spawn_file_actions_t * file_actionsp )
5189
+ #endif
5184
5190
{
5185
5191
PyObject * seq ;
5186
5192
PyObject * file_action = NULL ;
@@ -5225,11 +5231,13 @@ parse_file_actions(PyObject *file_actions,
5225
5231
{
5226
5232
goto fail ;
5227
5233
}
5234
+ #if defined(__GLIBC__ ) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ < 20 ))
5228
5235
PyList_Append (temp_buffer , path );
5236
+ #endif
5229
5237
errno = posix_spawn_file_actions_addopen (file_actionsp ,
5230
5238
fd , PyBytes_AS_STRING (path ), oflag , (mode_t )mode );
5231
5239
/* addopen copies the value except for some old versions of
5232
- * glibc (<2.26 ). The usage of temp_buffer is a workaround
5240
+ * glibc (<2.20 ). The usage of temp_buffer is a workaround
5233
5241
* to keep this temporary objects alive until posix_spawn
5234
5242
* gets called.*/
5235
5243
Py_DECREF (path );
@@ -5361,8 +5369,10 @@ os_posix_spawn_impl(PyObject *module, path_t *path, PyObject *argv,
5361
5369
* helper functions for manipulating file actions not copy the provided
5362
5370
* buffers. The use of `temp_buffer` here is a workaround that keeps the
5363
5371
* python objects that own the buffers alive until posix_spawn gets called.
5364
- * Check https://bugs.python.org/issue33630 for more info. */
5372
+ * Check https://bugs.python.org/issue33630 and
5373
+ * https://sourceware.org/bugzilla/show_bug.cgi?id=17048 for more info. */
5365
5374
5375
+ #if defined(__GLIBC__ ) && ((__GLIBC__ == 2 && __GLIBC_MINOR__ < 20 ))
5366
5376
temp_buffer = PyList_New (0 );
5367
5377
5368
5378
if (!temp_buffer ) {
@@ -5371,6 +5381,11 @@ os_posix_spawn_impl(PyObject *module, path_t *path, PyObject *argv,
5371
5381
if (parse_file_actions (file_actions , & file_actions_buf , temp_buffer )) {
5372
5382
goto exit ;
5373
5383
}
5384
+ #else
5385
+ if (parse_file_actions (file_actions , & file_actions_buf )) {
5386
+ goto exit ;
5387
+ }
5388
+ #endif
5374
5389
file_actionsp = & file_actions_buf ;
5375
5390
}
5376
5391
0 commit comments