I *always* forgotting svn add
[oweals/busybox.git] / networking / inetd.c
index 96642538500d2c4e2ed240bdd32786a6734b88a2..75665ba3e87fa14dd78f6fc859eb0437558d9b14 100644 (file)
@@ -419,7 +419,6 @@ static int bump_nofile (void)
 
 static void setup(servtab_t *sep)
 {
-       int on = 1;
        int r;
 
        sep->se_fd = socket(sep->se_family, sep->se_socktype, 0);
@@ -427,11 +426,8 @@ static void setup(servtab_t *sep)
                bb_perror_msg("%s/%s: socket", sep->se_service, sep->se_proto);
                return;
        }
-#define turnon(fd, opt) \
-setsockopt(fd, SOL_SOCKET, opt, (char *)&on, sizeof(on))
-       if (turnon(sep->se_fd, SO_REUSEADDR) < 0)
+       if (setsockopt_reuseaddr(sep->se_fd) < 0)
                bb_perror_msg("setsockopt(SO_REUSEADDR)");
-#undef turnon
 
 #ifdef CONFIG_FEATURE_INETD_RPC
        if (isrpcservice(sep)) {
@@ -763,7 +759,7 @@ static servtab_t *getconfigent(void)
        while (nsep != NULL) {
                nsep->se_checked = 1;
                if (nsep->se_family == AF_INET) {
-                       if (!strcmp(nsep->se_hostaddr, "*"))
+                       if (LONE_CHAR(nsep->se_hostaddr, '*'))
                                nsep->se_ctrladdr_in.sin_addr.s_addr = INADDR_ANY;
                        else if (!inet_aton(nsep->se_hostaddr, &nsep->se_ctrladdr_in.sin_addr)) {
                                struct hostent *hp;
@@ -839,7 +835,7 @@ static servtab_t *getconfigent(void)
        sigaddset(&m, SIGHUP); \
        sigaddset(&m, SIGALRM); \
        sigprocmask(SIG_BLOCK, &m, NULL); \
-} while(0)
+} while (0)
 
 static servtab_t *enter(servtab_t *cp)
 {
@@ -989,7 +985,7 @@ static void config(int sig ATTRIBUTE_UNUSED)
                        } else
 #endif
                        {
-                               u_short port = htons(atoi(sep->se_service));
+                               uint16_t port = htons(atoi(sep->se_service));
                                // FIXME: atoi_or_else(str, 0) would be handy here
                                if (!port) {
                                         /*XXX*/ strncpy(protoname, sep->se_proto, sizeof(protoname));
@@ -1041,8 +1037,8 @@ static void config(int sig ATTRIBUTE_UNUSED)
                                        register_rpc(sep);
                        } else
 #endif
-                               {
-                               u_short port = htons(atoi(sep->se_service));
+                       {
+                               uint16_t port = htons(atoi(sep->se_service));
 
                                if (!port) {
                                         /*XXX*/ strncpy(protoname, sep->se_proto, sizeof(protoname));
@@ -1371,7 +1367,7 @@ inetd_main(int argc, char *argv[])
                                        socklen_t plen = sizeof(peer);
 
                                        if (getpeername(ctrl, (struct sockaddr *) &peer, &plen) < 0) {
-                                               bb_error_msg("could not getpeername");
+                                               bb_error_msg("cannot getpeername");
                                                close(ctrl);
                                                continue;
                                        }
@@ -1499,7 +1495,7 @@ do_exit1:
                        if (!sep->se_wait && sep->se_socktype == SOCK_STREAM)
                                close(ctrl);
                } /* for (sep = servtab...) */
-       } /* for(;;) */
+       } /* for (;;) */
 }
 
 /*