#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
-
+#include <sys/wait.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <errno.h>
if (fd != channel[1]) close(fd);
#endif
- environ = envp;
+ if (envp) {
+ environ = envp;
+ }
/* Exec the program. */
if (search)
execvp(program, argv);