inetd: reformat with tabs for indentation

This commit is contained in:
Denis Vlasenko 2006-09-23 15:18:38 +00:00
parent 2dbeaa95ca
commit ec17d437ab

View File

@ -326,7 +326,7 @@ static int setconfig (void)
defhost = xstrdup("*");
if (fconfig != NULL) {
fseek(fconfig, 0L, SEEK_SET);
return (1);
return 1;
}
fconfig = fopen(CONFIG, "r");
return (fconfig != NULL);
@ -496,11 +496,11 @@ static char *nextline (void)
FILE *fd = fconfig;
if (fgets(line, sizeof(line), fd) == NULL)
return (NULL);
return NULL;
cp = strchr(line, '\n');
if (cp)
*cp = '\0';
return (line);
return line;
}
static char *skip(char **cpp) /* int report; */
@ -512,7 +512,7 @@ static char *skip (char **cpp) /* int report; */
if (*cpp == NULL) {
/* if (report) */
/* bb_error_msg("syntax error in inetd config file"); */
return (NULL);
return NULL;
}
again:
@ -528,7 +528,7 @@ again:
goto again;
*cpp = NULL;
/* goto erp; */
return (NULL);
return NULL;
}
start = cp;
while (*cp && *cp != ' ' && *cp != '\t')
@ -539,7 +539,7 @@ again:
/* goto erp; */
*cpp = cp;
return (start);
return start;
}
static servtab_t *new_servtab(void)
@ -575,7 +575,7 @@ static servtab_t *dupconfig (servtab_t *sep)
newtab->se_argv[argc] = xstrdup(sep->se_argv[argc]);
newtab->se_max = sep->se_max;
return (newtab);
return newtab;
}
static servtab_t *getconfigent(void)
@ -596,7 +596,7 @@ more:
while ((cp = nextline()) && *cp == '#');
if (cp == NULL) {
/* free(sep); */
return (NULL);
return NULL;
}
memset((char *) sep, 0, sizeof *sep);
@ -795,8 +795,8 @@ more:
hp->h_addr_list[i], sizeof(struct in_addr));
psep->se_ctrladdr_size = sizeof(psep->se_ctrladdr_in);
i++;
/* Prepend to list, don't want to look up its */
/* hostname again. */
/* Prepend to list, don't want to look up */
/* its hostname again. */
psep->se_next = sep;
sep = psep;
}
@ -834,17 +834,17 @@ more:
}
}
return (sep);
return sep;
}
#define Block_Using_Signals(m) do { sigemptyset(&m); \
#define Block_Using_Signals(m) do { \
sigemptyset(&m); \
sigaddset(&m, SIGCHLD); \
sigaddset(&m, SIGHUP); \
sigaddset(&m, SIGALRM); \
sigprocmask(SIG_BLOCK, &m, NULL); \
} while(0)
static servtab_t *enter(servtab_t *cp)
{
servtab_t *sep;
@ -860,19 +860,19 @@ static servtab_t *enter (servtab_t *cp)
sep->se_next = servtab;
servtab = sep;
sigprocmask(SIG_UNBLOCK, &omask, NULL);
return (sep);
return sep;
}
static int matchconf(servtab_t *old, servtab_t *new)
{
if (strcmp(old->se_service, new->se_service) != 0)
return (0);
return 0;
if (strcmp(old->se_hostaddr, new->se_hostaddr) != 0)
return (0);
return 0;
if (strcmp(old->se_proto, new->se_proto) != 0)
return (0);
return 0;
/*
* If the new servtab is bound to a specific address, check that the
@ -885,16 +885,16 @@ static int matchconf (servtab_t *old, servtab_t *new)
memcmp(&old->se_ctrladdr_in.sin_addr,
&new->se_ctrladdr_in.sin_addr,
sizeof(new->se_ctrladdr_in.sin_addr)) != 0)
return (0);
return 0;
#ifdef CONFIG_FEATURE_IPV6
if (old->se_family == AF_INET6 && new->se_family == AF_INET6 &&
memcmp(&old->se_ctrladdr_in6.sin6_addr,
&new->se_ctrladdr_in6.sin6_addr,
sizeof(new->se_ctrladdr_in6.sin6_addr)) != 0)
return (0);
return 0;
#endif
return (1);
return 1;
}
static void config(int sig ATTRIBUTE_UNUSED)
@ -1296,9 +1296,9 @@ inetd_main (int argc, char *argv[])
}
{
FILE *fp;
FILE *fp = fopen(_PATH_INETDPID, "w");
if ((fp = fopen (_PATH_INETDPID, "w")) != NULL) {
if (fp != NULL) {
fprintf(fp, "%u\n", getpid());
(void) fclose(fp);
}
@ -1355,14 +1355,16 @@ inetd_main (int argc, char *argv[])
}
readable = allsock;
if ((n = select (maxsock + 1, &readable, NULL, NULL, NULL)) <= 0) {
n = select(maxsock + 1, &readable, NULL, NULL, NULL)
if (n <= 0) {
if (n < 0 && errno != EINTR) {
bb_perror_msg("select");
sleep(1);
}
continue;
}
for (sep = servtab; n && sep; sep = sep->se_next)
for (sep = servtab; n && sep; sep = sep->se_next) {
// TODO: undo this unholy mess
if (sep->se_fd != -1 && FD_ISSET(sep->se_fd, &readable)) {
n--;
if (!sep->se_wait && sep->se_socktype == SOCK_STREAM) {
@ -1477,9 +1479,8 @@ inetd_main (int argc, char *argv[])
if (uid != pwd->pw_uid)
_exit(1);
} else if (pwd->pw_uid) {
if (sep->se_group) {
if (sep->se_group)
pwd->pw_gid = grp->gr_gid;
}
xsetgid((gid_t) pwd->pw_gid);
initgroups(pwd->pw_name, pwd->pw_gid);
xsetuid((uid_t) pwd->pw_uid);
@ -1510,6 +1511,7 @@ inetd_main (int argc, char *argv[])
}
}
}
}
/*
* Internet services provided internally by inetd:
@ -1522,11 +1524,11 @@ inetd_main (int argc, char *argv[])
static int dg_badinput(struct sockaddr_in *dg_sin)
{
if (ntohs(dg_sin->sin_port) < IPPORT_RESERVED)
return (1);
return 1;
if (dg_sin->sin_addr.s_addr == htonl(INADDR_BROADCAST))
return (1);
return 1;
/* XXX compare against broadcast addresses in SIOCGIFCONF list? */
return (0);
return 0;
}
#endif
@ -1557,7 +1559,8 @@ echo_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED)
struct sockaddr sa;
size = sizeof(sa);
if ((i = recvfrom (s, buffer, sizeof (buffer), 0, &sa, &size)) < 0)
i = recvfrom(s, buffer, sizeof(buffer), 0, &sa, &size);
if (i < 0)
return;
if (dg_badinput((struct sockaddr_in *) &sa))
return;
@ -1694,9 +1697,9 @@ static u_int machtime (void)
if (gettimeofday(&tv, NULL) < 0) {
fprintf(stderr, "Unable to get time of day\n");
return (0L);
return 0L;
}
return (htonl ((u_int) tv.tv_sec + 2208988800UL));
return htonl((u_int) tv.tv_sec + 2208988800UL);
}
/* ARGSUSED */
@ -1758,7 +1761,7 @@ daytime_dg (int s, servtab_t *sep ATTRIBUTE_UNUSED)
struct sockaddr sa;
socklen_t size;
t = time ((time_t *) 0);
t = time(NULL);
size = sizeof(sa);
if (recvfrom(s, buffer, sizeof(buffer), 0, &sa, &size) < 0)