From 35e643b39f6cc77b702c714cfa8e70f1e10601a9 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 28 Jul 2003 07:40:39 +0000 Subject: last_patch95 from vodz: Hi. Last patch have new libbb function vfork_rexec() for can use daemon() to uClinux system. This patched daemons: syslog, klogd, inetd, crond. This not tested! I havn`t this systems. Also. Previous patch for feature request MD5 crypt password for httpd don`t sended to this mailist on 07/15/03 (mailist have Pytom module problem?). The previous patch included, and have testing. --w vodz --- networking/inetd.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'networking/inetd.c') diff --git a/networking/inetd.c b/networking/inetd.c index 33b97ba94..af262c39c 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -806,7 +806,9 @@ inetd_main(int argc, char *argv[]) struct passwd *pwd; struct group *grp = NULL; struct sigaction sa; - int ch, pid; + int pid; + unsigned long opt; + char *sq; gid_t gid; #ifdef INETD_UNSUPPORT_BILTIN @@ -828,14 +830,21 @@ inetd_main(int argc, char *argv[]) LastArg = environ[-1] + strlen(environ[-1]); #endif - while ((ch = getopt(argc, argv, "q:")) != EOF) - switch(ch) { - case 'q': +#if defined(__uClinux__) + opt = bb_getopt_ulflags(argc, argv, "q:f", &sq); + if (!(opt & 4)) { + daemon(0, 0); + /* reexec for vfork() do continue parent */ + vfork_daemon_rexec(argc, argv, "-f"); + } +#else + opt = bb_getopt_ulflags(ac, av, "q:", &sq); + daemon(0, 0); +#endif /* uClinux */ + + if(opt & 1) { global_queuelen = atoi(optarg); if (global_queuelen < 8) global_queuelen=8; - break; - default: - bb_show_usage(); // "[-q len] [conf]" } argc -= optind; argv += optind; @@ -843,7 +852,6 @@ inetd_main(int argc, char *argv[]) if (argc > 0) CONFIG = argv[0]; - daemon(0, 0); openlog(bb_applet_name, LOG_PID | LOG_NOWAIT, LOG_DAEMON); { FILE *fp; -- cgit v1.2.3-55-g6feb