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
This commit is contained in:
Denis Vlasenko 2007-10-30 19:54:39 +00:00
parent 9130340adf
commit 9d1afdb571

View File

@ -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);
}