svn commit: trunk/busybox/networking
vda at busybox.net
vda at busybox.net
Tue Oct 30 19:54:39 UTC 2007
Author: vda
Date: 2007-10-30 12:54:39 -0700 (Tue, 30 Oct 2007)
New Revision: 20333
Log:
inetd: fix bug 1562 "inetd does not set argv[0] properly" (fix by IlyaPanfilov)
inetd: code shrink while at it
function old new delta
static.SOCK_xxx - 6 +6
getconfigent 1222 1123 -99
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/1 up/down: 6/-99) Total: -93 bytes
text data bss dec hex filename
776099 974 9420 786493 c003d busybox_old
776020 974 9420 786414 bffee busybox_unstripped
Modified:
trunk/busybox/networking/inetd.c
Changeset:
Modified: trunk/busybox/networking/inetd.c
===================================================================
--- trunk/busybox/networking/inetd.c 2007-10-30 19:36:54 UTC (rev 20332)
+++ trunk/busybox/networking/inetd.c 2007-10-30 19:54:39 UTC (rev 20333)
@@ -708,18 +708,17 @@
sep->se_service = xxstrdup(arg);
arg = skip(&cp);
- if (strcmp(arg, "stream") == 0)
- sep->se_socktype = SOCK_STREAM;
- else if (strcmp(arg, "dgram") == 0)
- sep->se_socktype = SOCK_DGRAM;
- else if (strcmp(arg, "rdm") == 0)
- sep->se_socktype = SOCK_RDM;
- else if (strcmp(arg, "seqpacket") == 0)
- sep->se_socktype = SOCK_SEQPACKET;
- else if (strcmp(arg, "raw") == 0)
- sep->se_socktype = SOCK_RAW;
- else
- sep->se_socktype = -1;
+ {
+ static int8_t SOCK_xxx[] ALIGN1 = {
+ -1,
+ SOCK_STREAM, SOCK_DGRAM, SOCK_RDM,
+ SOCK_SEQPACKET, SOCK_RAW
+ };
+ sep->se_socktype = SOCK_xxx[1 + index_in_strings(
+ "stream""\0" "dgram""\0" "rdm""\0"
+ "seqpacket""\0" "raw""\0"
+ , arg)];
+ }
sep->se_proto = xxstrdup(skip(&cp));
@@ -787,10 +786,9 @@
*arg++ = '\0';
sep->se_group = xstrdup(arg);
}
- /* if ((arg = skip(&cp, 1)) == NULL) */
- /* goto more; */
- sep->se_server = xxstrdup(skip(&cp));
+ arg = skip(&cp);
+ sep->se_server = xxstrdup(arg);
if (strcmp(sep->se_server, "internal") == 0) {
#ifdef INETD_FEATURE_ENABLED
const struct builtin *bi;
@@ -815,7 +813,7 @@
sep->se_bi = NULL;
#endif
argc = 0;
- for (arg = skip(&cp); cp; arg = skip(&cp)) {
+ for (; cp; arg = skip(&cp)) {
if (argc < MAXARGV)
sep->se_argv[argc++] = xxstrdup(arg);
}
More information about the busybox-cvs
mailing list