  };
  
  
-@@ -14826,6 +15313,23 @@ posixmodule_exec(PyObject *m)
+@@ -14826,6 +15315,23 @@ posixmodule_exec(PyObject *m)
  {
      _posixstate *state = get_posix_state(m);
  

     if ((state->billion = PyLong_FromLong(1000000000)) == NULL)
         return -1;
 #if defined(HAVE_WAIT3) || defined(HAVE_WAIT4)
@@ -15005,14 +15471,17 @@ posixmodule_exec(PyObject *m)
     if (!list) {
         return -1;
     }

+      }
     }
     else
 #endif
@@ -13609,6 +14019,7 @@ os_scandir_impl(PyObject *module, path_t
     errno = 0;
 #ifdef HAVE_FDOPENDIR
     if (path->fd != -1) {
+      if (HAVE_FDOPENDIR_RUNTIME) {
         /* closedir() closes the FD, so we duplicate it */
         fd = _Py_dup(path->fd);
         if (fd == -1)
@@ -13617,6 +14028,11 @@ os_scandir_impl(PyObject *module, path_t
         Py_BEGIN_ALLOW_THREADS
         iterator->dirp = fdopendir(fd);
         Py_END_ALLOW_THREADS
