Print this page
10125 smatch fixes for cmd-inet

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/cmd-inet/usr.sbin/wificonfig/wificonfig.c
          +++ new/usr/src/cmd/cmd-inet/usr.sbin/wificonfig/wificonfig.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26      -#pragma ident   "%Z%%M% %I%     %E% SMI"
       26 +/*
       27 + * Copyright (c) 2018, Joyent, Inc.
       28 + */
  27   29  
  28   30  #include <stdio.h>
  29   31  #include <stdlib.h>
  30   32  #include <stddef.h>
  31   33  #include <errno.h>
  32   34  #include <ctype.h>
  33   35  #include <stdarg.h>
  34   36  #include <fcntl.h>
  35   37  #include <unistd.h>
  36   38  #include <net/if.h>
↓ open down ↓ 2487 lines elided ↑ open up ↑
2524 2526                                  (void) del_section(gp_wepkey_file, section_id);
2525 2527                                  /*
2526 2528                                   * remove the '[]' of the [section_id]
2527 2529                                   */
2528 2530                                  prefer = section_id + 1;
2529 2531                                  *(prefer + strlen(section_id) - 2) = '\0';
2530 2532                                  (void) del_prefer(gp_config_file, prefer,
2531 2533                                      B_FALSE);
2532 2534                                  free(section_id);
2533 2535                                  p_section = p_sectionbak;
2534      -                                        continue;
     2536 +                                continue;
2535 2537                          }
2536 2538                          p_section = p_section->section_next;
2537 2539                  }
2538 2540                  return (B_TRUE);
2539 2541          }
2540 2542          if (gp_config_file != NULL) {
2541 2543                  for (i = 0; i < argc; i++) {
2542 2544                          section_id = append_pa(argv[i]);
2543 2545                          if (del_section(gp_config_file, section_id)
2544 2546                              == B_FALSE) {
↓ open down ↓ 199 lines elided ↑ open up ↑
2744 2746           */
2745 2747          if (strcasecmp(argv[0], "all") == 0) {
2746 2748                  p_section = find_section(gp_config_file, WIFI_PREFER);
2747 2749                  if (p_section != NULL)
2748 2750                          plist = p_section->list;
2749 2751  
2750 2752                  if ((p_section == NULL) || (plist == NULL))
2751 2753                          return (B_FALSE);
2752 2754                  pae = plist->ael_head;
2753 2755                  while (pae != NULL) {
     2756 +                        ae_t *next = pae->ae_next;
2754 2757                          free(pae);
2755      -                        pae = pae->ae_next;
     2758 +                        pae = next;
2756 2759                  }
2757 2760                  plist->ael_head = plist->ael_tail = NULL;
2758 2761                  plist->ael_argc = 0;
2759 2762          } else if (gp_config_file != NULL) {
2760 2763                  for (i = 0; i < argc; i++) {
2761 2764                          if (del_prefer(gp_config_file, argv[i], B_TRUE)
2762 2765                              == B_FALSE) {
2763 2766                                  return (B_FALSE);
2764 2767                          }
2765 2768                  }
↓ open down ↓ 2163 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX