diff --git a/cbits/posix/common.h b/cbits/posix/common.h
new file mode 100644
--- /dev/null
+++ b/cbits/posix/common.h
@@ -0,0 +1,52 @@
+#pragma once
+
+#include "runProcess.h"
+
+enum std_handle_behavior {
+    // Close the handle
+    STD_HANDLE_CLOSE,
+    // dup2 the specified fd to standard handle
+    STD_HANDLE_USE_FD,
+    // dup2 the appropriate end of the given pipe to the standard handle and
+    // close the other end.
+    STD_HANDLE_USE_PIPE
+};
+
+struct std_handle {
+    enum std_handle_behavior behavior;
+    union {
+        int use_fd;
+        struct {
+            int parent_end, child_end;
+        } use_pipe;
+    };
+};
+
+int get_max_fd(void);
+
+// defined in find_executable.c
+#if !defined(HAVE_execvpe)
+char *find_executable(char *filename);
+#endif
+
+// defined in fork_exec.c
+ProcHandle
+do_spawn_fork (char *const args[],
+               char *workingDirectory, char **environment,
+               struct std_handle *stdInHdl,
+               struct std_handle *stdOutHdl,
+               struct std_handle *stdErrHdl,
+               gid_t *childGroup, uid_t *childUser,
+               int flags,
+               char **failed_doing);
+
+// defined in posix_spawn.c
+ProcHandle
+do_spawn_posix (char *const args[],
+                char *workingDirectory, char **environment,
+                struct std_handle *stdInHdl,
+                struct std_handle *stdOutHdl,
+                struct std_handle *stdErrHdl,
+                gid_t *childGroup, uid_t *childUser,
+                int flags,
+                char **failed_doing);
diff --git a/cbits/posix/find_executable.c b/cbits/posix/find_executable.c
--- a/cbits/posix/find_executable.c
+++ b/cbits/posix/find_executable.c
@@ -11,7 +11,7 @@
 
 #include "common.h"
 
-// the below is only necessary when we don't have execvpe.
+// the below is only necessary when we need to emulate execvpe.
 #if !defined(HAVE_execvpe)
 
 /* Return true if the given file exists and is an executable. */
@@ -28,7 +28,16 @@
     char *tokbuf;
     char *path = strtok_r(search_path, ":", &tokbuf);
     while (path != NULL) {
+	// N.B. gcc 6.3.0, used by Debian 9, inexplicably warns that `path`
+	// may not be initialised with -Wall.  Silence this warning. See #210.
+#if defined(__GNUC__) && __GNUC__ == 6 && __GNUC_MINOR__ == 3
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
         const int tmp_len = filename_len + 1 + strlen(path) + 1;
+#if defined(__GNUC__) && __GNUC__ == 6 && __GNUC_MINOR__ == 3
+#pragma GCC diagnostic pop
+#endif
         char *tmp = malloc(tmp_len);
         snprintf(tmp, tmp_len, "%s/%s", path, filename);
         if (is_executable(tmp)) {
diff --git a/cbits/posix/fork_exec.c b/cbits/posix/fork_exec.c
--- a/cbits/posix/fork_exec.c
+++ b/cbits/posix/fork_exec.c
@@ -62,7 +62,6 @@
     case STD_HANDLE_CLOSE:
         if (close(fd) == -1) {
             child_failed(pipe, "close");
-            return -1;
         }
         return 0;
 
@@ -84,7 +83,12 @@
         if (close(b->use_pipe.parent_end) == -1) {
             child_failed(pipe, "close(parent_end)");
         }
-        break;
+	return 0;
+
+    default:
+	// N.B. this should be unreachable but some compilers apparently can't
+	// see this.
+        child_failed(pipe, "setup_std_handle_fork(invalid behavior)");
     }
 }
 
@@ -219,7 +223,7 @@
 
         /* Reset the SIGINT/SIGQUIT signal handlers in the child, if requested
          */
-        if (flags & RESET_INT_QUIT_HANDLERS != 0) {
+        if ((flags & RESET_INT_QUIT_HANDLERS) != 0) {
             struct sigaction dfl;
             (void)sigemptyset(&dfl.sa_mask);
             dfl.sa_flags = 0;
diff --git a/cbits/posix/posix_spawn.c b/cbits/posix/posix_spawn.c
--- a/cbits/posix/posix_spawn.c
+++ b/cbits/posix/posix_spawn.c
@@ -64,6 +64,13 @@
             return -1;
         }
         return 0;
+
+    default:
+	// N.B. this should be unreachable
+	// but some compilers apparently can't
+	// see this.
+        *failed_doing = "posix_spawn_file_actions_addclose(invalid behavior)";
+        return -1;
     }
 }
 
@@ -143,11 +150,13 @@
 #endif
     }
 
-#if defined(HAVE_POSIX_SPAWN_SETPGROUP)
     if ((flags & RUN_PROCESS_IN_NEW_GROUP) != 0) {
+#if defined(HAVE_POSIX_SPAWN_SETPGROUP)
         spawn_flags |= POSIX_SPAWN_SETPGROUP;
-    }
+#else
+	goto not_supported;
 #endif
+    }
 
     if (setup_std_handle_spawn(STDIN_FILENO,  stdInHdl,  &fa, failed_doing) != 0) {
         goto fail;
diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,9 @@
 # Changelog for [`process` package](http://hackage.haskell.org/package/process)
 
+## 1.6.13.1 *July 2021*
+
+* Patches for the previous release
+
 ## 1.6.13.0 *July 2021*
 
 * Refactoring of POSIX process logic [#208](https://github.com/haskell/process/pull/208)
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -3862,7 +3862,11 @@
 fi
 done
 
-ac_fn_c_check_decl "$LINENO" "POSIX_SPAWN_SETSID" "ac_cv_have_decl_POSIX_SPAWN_SETSID" "$ac_includes_default"
+ac_fn_c_check_decl "$LINENO" "POSIX_SPAWN_SETSID" "ac_cv_have_decl_POSIX_SPAWN_SETSID" "
+  #define _GNU_SOURCE
+  #include <spawn.h>
+
+"
 if test "x$ac_cv_have_decl_POSIX_SPAWN_SETSID" = xyes; then :
   ac_have_decl=1
 else
@@ -3872,7 +3876,11 @@
 cat >>confdefs.h <<_ACEOF
 #define HAVE_DECL_POSIX_SPAWN_SETSID $ac_have_decl
 _ACEOF
-ac_fn_c_check_decl "$LINENO" "POSIX_SPAWN_SETSID_NP" "ac_cv_have_decl_POSIX_SPAWN_SETSID_NP" "$ac_includes_default"
+ac_fn_c_check_decl "$LINENO" "POSIX_SPAWN_SETSID_NP" "ac_cv_have_decl_POSIX_SPAWN_SETSID_NP" "
+  #define _GNU_SOURCE
+  #include <spawn.h>
+
+"
 if test "x$ac_cv_have_decl_POSIX_SPAWN_SETSID_NP" = xyes; then :
   ac_have_decl=1
 else
@@ -3883,7 +3891,11 @@
 #define HAVE_DECL_POSIX_SPAWN_SETSID_NP $ac_have_decl
 _ACEOF
 
-ac_fn_c_check_decl "$LINENO" "POSIX_SPAWN_SETPGROUP" "ac_cv_have_decl_POSIX_SPAWN_SETPGROUP" "$ac_includes_default"
+ac_fn_c_check_decl "$LINENO" "POSIX_SPAWN_SETPGROUP" "ac_cv_have_decl_POSIX_SPAWN_SETPGROUP" "
+  #define _GNU_SOURCE
+  #include <spawn.h>
+
+"
 if test "x$ac_cv_have_decl_POSIX_SPAWN_SETPGROUP" = xyes; then :
   ac_have_decl=1
 else
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -18,9 +18,18 @@
 
 # posix_spawn checks
 AC_CHECK_HEADERS([spawn.h])
-AC_CHECK_FUNCS([posix_spawnp posix_spawn_file_actions_addchdir])
-AC_CHECK_DECLS([POSIX_SPAWN_SETSID, POSIX_SPAWN_SETSID_NP])
-AC_CHECK_DECLS([POSIX_SPAWN_SETPGROUP])
+AC_CHECK_FUNCS([posix_spawnp posix_spawn_file_actions_addchdir],[],[],[
+  #define _GNU_SOURCE
+  #include <spawn.h>
+])
+AC_CHECK_DECLS([POSIX_SPAWN_SETSID, POSIX_SPAWN_SETSID_NP],[],[],[
+  #define _GNU_SOURCE
+  #include <spawn.h>
+])
+AC_CHECK_DECLS([POSIX_SPAWN_SETPGROUP],[],[],[
+  #define _GNU_SOURCE
+  #include <spawn.h>
+])
 
 FP_CHECK_CONSTS([SIG_DFL SIG_IGN])
 
diff --git a/process.cabal b/process.cabal
--- a/process.cabal
+++ b/process.cabal
@@ -1,5 +1,5 @@
 name:          process
-version:       1.6.13.0
+version:       1.6.13.1
 -- NOTE: Don't forget to update ./changelog.md
 license:       BSD3
 license-file:  LICENSE
@@ -27,6 +27,7 @@
     process.buildinfo
     exes/echo.bat
     exes/subdir/echo.bat
+    cbits/posix/common.h
 
 extra-tmp-files:
     autom4te.cache
