nc: show help text on bad parameters
[oweals/busybox.git] / networking / inetd.c
index 4b9d01294cd1791843525eba6aaad8c7121b0626..7030062b6e1f7a90b47aee7c857d2aa65a012d71 100644 (file)
@@ -313,7 +313,7 @@ struct globals {
        fd_set allsock;
        /* Used in next_line(), and as scratch read buffer */
        char line[256];          /* _at least_ 256, see LINE_SIZE */
-};
+} FIX_ALIASING;
 #define G (*(struct globals*)&bb_common_bufsiz1)
 enum { LINE_SIZE = COMMON_BUFSIZE - offsetof(struct globals, line) };
 struct BUG_G_too_big {
@@ -1271,7 +1271,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
                                        pid = vfork();
 
                                if (pid < 0) { /* fork error */
-                                       bb_perror_msg("fork");
+                                       bb_perror_msg("vfork"+1);
                                        sleep(1);
                                        restore_sigmask(&omask);
                                        maybe_close(accepted_fd);
@@ -1361,9 +1361,9 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
                                if (setrlimit(RLIMIT_NOFILE, &rlim_ofile) < 0)
                                        bb_perror_msg("setrlimit");
 
-                       /*closelog(); - BAD, we are after vfork,
-                        * this may confuse syslog() state.
-                        * Let's hope libc set syslog fd to CLOEXEC...
+                       /* closelog(); - WRONG. we are after vfork,
+                        * this may confuse syslog() internal state.
+                        * Let's hope libc sets syslog fd to CLOEXEC...
                         */
                        xmove_fd(ctrl, STDIN_FILENO);
                        xdup2(STDIN_FILENO, STDOUT_FILENO);
@@ -1380,7 +1380,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv)
                        sigaction_set(SIGPIPE, &saved_pipe_handler);
                        restore_sigmask(&omask);
                        BB_EXECVP(sep->se_program, sep->se_argv);
-                       bb_perror_msg("exec %s", sep->se_program);
+                       bb_perror_msg("can't execute '%s'", sep->se_program);
  do_exit1:
                        /* eat packet in udp case */
                        if (sep->se_socktype != SOCK_STREAM)
@@ -1475,9 +1475,8 @@ static void init_ring(void)
        int i;
 
        end_ring = ring;
-       for (i = 0; i <= 128; ++i)
-               if (isprint(i))
-                       *end_ring++ = i;
+       for (i = ' '; i < 127; i++)
+               *end_ring++ = i;
 }
 /* Character generator. MMU arches only. */
 /* ARGSUSED */