[git commit] inetd: comment why we redirect stderr to network

Denys Vlasenko vda.linux at googlemail.com
Fri Jun 5 13:35:36 UTC 2009


commit: http://git.busybox.net/busybox/commit/?id=0f952c249e30834a3ee5cd821e9afc3197b05f9c
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master


Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/inetd.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/networking/inetd.c b/networking/inetd.c
index 031edc3..331c494 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -1356,9 +1356,12 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
 				if (setrlimit(RLIMIT_NOFILE, &rlim_ofile) < 0)
 					bb_perror_msg("setrlimit");
 			closelog();
-			xmove_fd(ctrl, 0);
-			xdup2(0, 1);
-			xdup2(0, 2);
+			xmove_fd(ctrl, STDIN_FILENO);
+			xdup2(STDIN_FILENO, STDOUT_FILENO);
+			/* manpages of inetd I managed to find either say
+			 * that stderr is also redirected to the network,
+			 * or do not talk about redirection at all (!) */
+			xdup2(STDIN_FILENO, STDERR_FILENO);
 			/* NB: among others, this loop closes listening socket
 			 * for nowait stream children */
 			for (sep2 = serv_list; sep2; sep2 = sep2->se_next)
-- 
1.6.0.6


More information about the busybox-cvs mailing list