httpd: don't send error messages with gzip encoding
[oweals/busybox.git] / networking / vconfig.c
index 7b6c2fa0404785538c921a1efb732ef0d3a815d4..13c65ad781b41d7d042dd8c65336bee6f43f2beb 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Copyright (C) 2001  Manuel Novoa III  <mjn3@codepoet.org>
  *
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 
 /* BB_AUDIT SUSv3 N/A */
@@ -47,16 +47,17 @@ struct vlan_ioctl_args {
        short vlan_qos;
 };
 
-#define VLAN_GROUP_ARRAY_LEN 4096
-#define SIOCSIFVLAN    0x8983          /* Set 802.1Q VLAN options */
+#define VLAN_GROUP_ARRAY_LEN  4096
+#define SIOCSIFVLAN           0x8983  /* Set 802.1Q VLAN options */
 
-/* On entry, table points to the length of the current string plus
- * nul terminator plus data length for the subsequent entry.  The
- * return value is the last data entry for the matching string. */
+/* On entry, table points to the length of the current string
+ * plus NUL terminator plus data length for the subsequent entry.
+ * The return value is the last data entry for the matching string. */
 static const char *xfind_str(const char *table, const char *str)
 {
        while (strcasecmp(str, table+1) != 0) {
-               if (!*(table += table[0])) {
+               table += table[0];
+               if (!*table) {
                        bb_show_usage();
                }
        }
@@ -121,7 +122,7 @@ int vconfig_main(int argc, char **argv)
        /* Will die if 802.1q is not present */
        xopen(conf_file_name, O_RDONLY);
 
-       memset(&ifr, 0, sizeof(struct vlan_ioctl_args));
+       memset(&ifr, 0, sizeof(ifr));
 
        ++argv;
        p = xfind_str(cmds+2, *argv);
@@ -133,10 +134,7 @@ int vconfig_main(int argc, char **argv)
        if (ifr.cmd == SET_VLAN_NAME_TYPE_CMD) { /* set_name_type */
                ifr.u.name_type = *xfind_str(name_types+1, argv[1]);
        } else {
-               if (strlen(argv[1]) >= IF_NAMESIZE) {
-                       bb_error_msg_and_die("if_name >= %d chars", IF_NAMESIZE);
-               }
-               strcpy(ifr.device1, argv[1]);
+               strncpy_IFNAMSIZ(ifr.device1, argv[1]);
                p = argv[2];
 
                /* I suppose one could try to combine some of the function calls below,