Print this page
10120 smatch indenting fixes for usr/src/cmd
Reviewed by: Gergő Doma <domag02@gmail.com>
Portions contributed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/pathchk/pathchk.c
          +++ new/usr/src/cmd/pathchk/pathchk.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   *
  14   14   * When distributing Covered Code, include this CDDL HEADER in each
  15   15   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   16   * If applicable, add the following below this CDDL HEADER, with the
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*
  23      - *
  24      - *  Copyright (c) 1994 by Sun Microsystems, Inc.
       23 + * Copyright (c) 1994 by Sun Microsystems, Inc.
       24 + * Copyright (c) 2018, Joyent, Inc.
  25   25   */
  26   26  
  27   27  /*
  28   28   * Copyright 1991, 1992 by Mortice Kern Systems Inc.  All rights reserved.
  29   29   *
  30   30   * Standards Conformance :
  31   31   *      P1003.2/D11.2
  32   32   *
  33   33   */
  34      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  35   34  /*
  36   35   * Original ident string for reference
  37   36   * ident        "$Id: pathchk.c,v 1.29 1994/05/24 15:51:19 mark Exp $"
  38   37   */
  39   38  
  40   39  #include <locale.h>
  41   40  #include <libintl.h>
  42   41  #include <limits.h>
  43   42  #include <sys/stat.h>
  44   43  #include <fcntl.h>              /* for creat() prototype */
↓ open down ↓ 195 lines elided ↑ open up ↑
 240  239                           */
 241  240                          return (0);
 242  241                  }
 243  242  
 244  243                  scomp = p;
 245  244  
 246  245                  /*
 247  246                   * Find the end of the current component
 248  247                   * and check for valid characters in the component
 249  248                   */
 250      -                 while (*p != '\0' && !M_FSDELIM(*p)) {
      249 +                while (*p != '\0' && !M_FSDELIM(*p)) {
 251  250                          /*
 252  251                           * for pflag: check for PFCS characters
 253  252                           * otherwise assume all characters are valid
 254  253                           */
 255  254                          if (pflag && (strchr(portfsset, *p) == 0)) {
 256  255                                  if (isprint(*p)) {
 257  256                                          (void) fprintf(stderr,
 258  257                                              gettext(badchar), path, *p, *p);
 259  258                                  } else {
 260  259                                          (void) fprintf(stderr,
↓ open down ↓ 12 lines elided ↑ open up ↑
 273  272                   */
 274  273                  if ((nameMax != -1) && (ecomp - scomp > nameMax)) {
 275  274                          (void) fprintf(stderr, gettext(nametoolong), scomp);
 276  275                          return (1);
 277  276                  } else if (!pflag && checkStat) {
 278  277                          /*
 279  278                           * Perform the extra checks that
 280  279                           * are required when not just
 281  280                           * checking for portability.
 282  281                           */
 283      -                         struct stat sb;
 284      -                         char fsdelim;
      282 +                        struct stat sb;
      283 +                        char fsdelim;
 285  284  
 286      -                         fsdelim = *ecomp;
 287      -                         *ecomp = '\0';
      285 +                        fsdelim = *ecomp;
      286 +                        *ecomp = '\0';
 288  287  
 289      -                         if (stat(path, &sb) == -1) {
      288 +                        if (stat(path, &sb) == -1) {
 290  289                                  /*
 291  290                                   * We error out if an
 292  291                                   * intermediate component
 293  292                                   * is a file, when we
 294  293                                   * were expecting a
 295  294                                   * directory, or it is an
 296  295                                   * unsearchable directory.
 297  296                                   */
 298  297                                  if ((errno == ENOTDIR && fsdelim != '\0') ||
 299  298                                      (errno == EACCES)) {
 300  299                                          (void) fprintf(stderr, gettext(notsrch),
 301  300                                                  path);
 302  301                                          return (1);
 303  302                                  } else if (errno == ENOENT) {
 304  303                                          checkStat = 0;
 305  304                                  }
 306      -                         } else if (S_ISDIR(sb.st_mode)) {
      305 +                        } else if (S_ISDIR(sb.st_mode)) {
 307  306                                  /*
 308  307                                   * If the current prefix is a
 309  308                                   * directory, then we need to
 310  309                                   * update the limits for NAME_MAX
 311  310                                   * for the next component and the suffix.
 312  311                                   */
 313  312                                  if (checkPathConf(path, _PC_NAME_MAX,
 314  313                                      &nameMax)) {
 315  314                                          (void) fprintf(stderr,
 316  315                                              gettext(notsrch), path);
↓ open down ↓ 25 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX