svn commit: trunk/busybox/networking
vda at busybox.net
vda at busybox.net
Sat Mar 29 09:00:52 PDT 2008
Author: vda
Date: 2008-03-29 09:00:52 -0700 (Sat, 29 Mar 2008)
New Revision: 21556
Log:
inetd: small shrink for NOMMU case
function old new delta
cat_args - 8 +8
echo_stream 64 63 -1
discard_stream 64 63 -1
static.args 32 12 -20
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 8/-22) Total: -14 bytes
Modified:
trunk/busybox/networking/inetd.c
Changeset:
Modified: trunk/busybox/networking/inetd.c
===================================================================
--- trunk/busybox/networking/inetd.c 2008-03-29 15:11:07 UTC (rev 21555)
+++ trunk/busybox/networking/inetd.c 2008-03-29 16:00:52 UTC (rev 21556)
@@ -1413,6 +1413,10 @@
} /* for (;;) */
}
+#if !BB_MMU
+static const char *const cat_args[] = { "cat", NULL };
+#endif
+
/*
* Internet services provided internally by inetd:
*/
@@ -1430,13 +1434,13 @@
}
#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
}
@@ -1467,13 +1471,14 @@
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
}
More information about the busybox-cvs
mailing list