} /* for (;;) */
}
+#if !BB_MMU
+static const char *const cat_args[] = { "cat", NULL };
+#endif
+
/*
* Internet services provided internally by inetd:
*/
}
#else
/* We are after vfork here! */
- static const char *const args[] = { "cat", NULL };
- /* move network socket to stdin */
+ /* move network socket to stdin/stdout */
xmove_fd(s, STDIN_FILENO);
xdup2(STDIN_FILENO, STDOUT_FILENO);
/* no error messages please... */
- xmove_fd(xopen("/dev/null", O_WRONLY), STDERR_FILENO);
- BB_EXECVP("cat", (char**)args);
+ close(STDERR_FILENO);
+ xopen("/dev/null", O_WRONLY);
+ BB_EXECVP("cat", (char**)cat_args);
/* on failure we return to main, which does exit(1) */
#endif
}
continue;
#else
/* We are after vfork here! */
- static const char *const args[] = { "dd", "of=/dev/null", NULL };
/* move network socket to stdin */
xmove_fd(s, STDIN_FILENO);
- xdup2(STDIN_FILENO, STDOUT_FILENO);
- /* no error messages */
- xmove_fd(xopen("/dev/null", O_WRONLY), STDERR_FILENO);
- BB_EXECVP("dd", (char**)args);
+ /* discard output */
+ close(STDOUT_FILENO);
+ xopen("/dev/null", O_WRONLY);
+ /* no error messages please... */
+ xdup2(STDOUT_FILENO, STDERR_FILENO);
+ BB_EXECVP("cat", (char**)cat_args);
/* on failure we return to main, which does exit(1) */
#endif
}