/** Execute a program assuming that the caller waits for it to finish.
*
- * The caller takes responsibility for calling waitpid() on the returned PID.
+ * The caller takes responsibility for calling waitpid() on the returned PID.
*
- * The caller takes responsibility for reading from the returned FD,
- * and closing it.
+ * The caller takes responsibility for reading from the returned FD,
+ * and closing it.
*
* @param[out] pid_p The PID of the child
* @param[out] stdin_fd The stdin FD of the child.
close(stdout_pipe[1]);
close(stderr_pipe[0]);
close(stderr_pipe[1]);
+ *pid_p = -1; /* Ensure the PID is set even if the caller didn't check the return code */
talloc_free(argv);
return -1;
}