nc: show help text on bad parameters
[oweals/busybox.git] / networking / ifupdown.c
index 714d2a1079e6f4e188a99703ab5a61790c9d078b..864fc2acd0da48e09ede3d0e98f68e26d039cc09 100644 (file)
@@ -14,7 +14,7 @@
  *  (defined via CONFIG_IFUPDOWN_IFSTATE_PATH) and can be overridden by build
  *  configuration.
  *
- * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 
 #include "libbb.h"
@@ -483,7 +483,7 @@ struct dhcp_client_t {
 
 static const struct dhcp_client_t ext_dhcp_clients[] = {
        { "dhcpcd",
-               "dhcpcd[[ -h %hostname%]][[ -i %vendor%]][[ -I %clientid%]][[ -l %leasetime%]] %iface%",
+               "dhcpcd[[ -h %hostname%]][[ -i %vendor%]][[ -I %client%]][[ -l %leasetime%]] %iface%",
                "dhcpcd -k %iface%",
        },
        { "dhclient",
@@ -495,7 +495,7 @@ static const struct dhcp_client_t ext_dhcp_clients[] = {
                "pump -i %iface% -k",
        },
        { "udhcpc",
-               "udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -H %hostname%]][[ -c %clientid%]]"
+               "udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid -i %iface%[[ -H %hostname%]][[ -c %client%]]"
                                "[[ -s %script%]][[ %udhcpc_opts%]]",
                "kill `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null",
        },
@@ -535,7 +535,7 @@ static int FAST_FUNC dhcp_up(struct interface_defn_t *ifd, execfn *exec)
                return 0;
 #endif
        return execute("udhcpc " UDHCPC_CMD_OPTIONS " -p /var/run/udhcpc.%iface%.pid "
-                       "-i %iface%[[ -H %hostname%]][[ -c %clientid%]][[ -s %script%]][[ %udhcpc_opts%]]",
+                       "-i %iface%[[ -H %hostname%]][[ -c %client%]][[ -s %script%]][[ %udhcpc_opts%]]",
                        ifd, exec);
 }
 #else
@@ -1041,19 +1041,16 @@ static int popen2(FILE **in, FILE **out, char *command, char *param)
        xpiped_pair(outfd);
 
        fflush_all();
-       pid = vfork();
+       pid = xvfork();
 
-       switch (pid) {
-       case -1:  /* failure */
-               bb_perror_msg_and_die("vfork");
-       case 0:  /* child */
+       if (pid == 0) {
+               /* Child */
                /* NB: close _first_, then move fds! */
                close(infd.wr);
                close(outfd.rd);
                xmove_fd(infd.rd, 0);
                xmove_fd(outfd.wr, 1);
-               BB_EXECVP(command, argv);
-               bb_perror_msg_and_die("can't execute '%s'", command);
+               BB_EXECVP_or_die(argv);
        }
        /* parent */
        close(infd.rd);