mirror of
https://github.com/troglobit/finit.git
synced 2026-11-21 19:51:46 +00:00
Issue #14: Improved support for static Finit builds
- Upgrade libite (LITE) for new UNIX file parser API to improve static builds of Finit. - Re-enable bootmisc plugin for static builds by adding built-in support for reading GID from /etc/group. - Allow inetd support for static builds by adding built-in support for reading service and protocol from /etc/services and /etc/protocols. - Do not try to install/uninstall any plugins for static builds. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
b2c5e97417
commit
369fcf2100
6 files changed
+46
-9
No files matched your search
@@ -217,7 +217,22 @@ void inetd_stop(inetd_t *inetd)
|
||||
|
||||
static int getent(char *service, char *proto, struct servent **sv, struct protoent **pv)
|
||||
{
|
||||
#ifdef ENABLE_STATIC
|
||||
int service_num;
|
||||
static struct servent lfs;
|
||||
|
||||
service_num = fgetint("/etc/services", " \n\t", service);
|
||||
if (service_num > 0) {
|
||||
lfs.s_name = service;
|
||||
lfs.s_port = htons(service_num);
|
||||
lfs.s_proto = NULL;
|
||||
if (!strcmp("tcp", proto) || !strcmp("udp", proto))
|
||||
lfs.s_proto = proto;
|
||||
*sv = &lfs;
|
||||
}
|
||||
#else
|
||||
*sv = getservbyname(service, proto);
|
||||
#endif
|
||||
if (!*sv) {
|
||||
const char *errstr;
|
||||
static struct servent s;
|
||||
@@ -238,8 +253,20 @@ static int getent(char *service, char *proto, struct servent **sv, struct protoe
|
||||
*sv = &s;
|
||||
}
|
||||
|
||||
if (pv) {
|
||||
if (pv && (*sv)->s_proto) {
|
||||
#ifdef ENABLE_STATIC
|
||||
int proto_num;
|
||||
static struct protoent lfp;
|
||||
|
||||
proto_num = fgetint("/etc/protocols", " \n\t", (*sv)->s_proto);
|
||||
if (proto_num > 0) {
|
||||
lfp.p_name = proto;
|
||||
lfp.p_proto = proto_num;
|
||||
}
|
||||
*pv = &lfp;
|
||||
#else
|
||||
*pv = getprotobyname((*sv)->s_proto);
|
||||
#endif
|
||||
if (!*pv) {
|
||||
_e("Cannot find proto %s, skipping.", (*sv)->s_proto);
|
||||
return errno = EINVAL;
|
||||
|
||||
Reference in new issue
Block a user