diff options
author | Mike Frysinger | 2010-11-22 04:57:37 +0100 |
---|---|---|
committer | Denys Vlasenko | 2010-11-22 04:57:37 +0100 |
commit | a945f6190b9ffdd316e8590c0b4fcb25dee7676e (patch) | |
tree | ddae3bd9f61845aecbe1bb4d3cf91ee0838225de /networking | |
parent | f3763033e457b100a863731c16a80648d85995c9 (diff) | |
download | busybox-a945f6190b9ffdd316e8590c0b4fcb25dee7676e.zip busybox-a945f6190b9ffdd316e8590c0b4fcb25dee7676e.tar.gz |
inetd: if argv[0] is not specified, set it to program name
With inetd.conf files that skip argv[], inetd execs programs with argc==0.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r-- | networking/inetd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/networking/inetd.c b/networking/inetd.c index ac42c52..fb00c6c 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -778,6 +778,12 @@ static servtab_t *parse_one_line(void) argc = 0; while ((arg = token[6+argc]) != NULL && argc < MAXARGV) sep->se_argv[argc++] = xstrdup(arg); + /* Some inetd.conf files have no argv's, not even argv[0]. + * Fix them up. + * (Technically, programs can be execed with argv[0] = NULL, + * but many programs do not like that at all) */ + if (argc == 0) + sep->se_argv[0] = xstrdup(sep->se_program); /* catch mixups. "<service> stream udp ..." == wtf */ if (sep->se_socktype == SOCK_STREAM) { |