+#ifndef DOS_NT
+
+/* 'exec' failed inside a child running NAME, with error number ERR.
+ Possibly a vforked child needed to allocate a large vector on the
+ stack; such a child cannot fall back on malloc because that might
+ mess up the allocator's data structures in the parent.
+ Report the error and exit the child. */
+
+static _Noreturn void
+exec_failed (char const *name, int err)
+{
+ /* Avoid deadlock if the child's perror writes to a full pipe; the
+ pipe's reader is the parent, but with vfork the parent can't
+ run until the child exits. Truncate the diagnostic instead. */
+ fcntl (STDERR_FILENO, F_SETFL, O_NONBLOCK);
+
+ errno = err;
+ emacs_perror (name);
+ _exit (err == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE);
+}
+
+#else
+
+/* Do nothing. There is no need to fail, as DOS_NT platforms do not
+ fork and exec, and handle alloca exhaustion in a different way. */
+
+static void
+exec_failed (char const *name, int err)
+{
+}
+
+#endif
+