summaryrefslogtreecommitdiffhomepage
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-10-30 19:54:39 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-10-30 19:54:39 +0000
commit9d1afdb571e0ba3053616d74edc99a68325ef5e9 (patch)
tree1f65809702a359afc32428dbcd0f1fba505347f0 /networking
parent9130340adfcfe28dff626d6306266883c0070e44 (diff)
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
Diffstat (limited to 'networking')
-rw-r--r--networking/inetd.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/networking/inetd.c b/networking/inetd.c
index 8dca8fc3c..94d3df6e2 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -708,18 +708,17 @@ static servtab_t *getconfigent(void)
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 @@ static servtab_t *getconfigent(void)
*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 @@ static servtab_t *getconfigent(void)
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);
}