Print this page
8485 Remove set but unused variables in usr/src/cmd

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/svr4pkg/pkgremove/special.c
          +++ new/usr/src/cmd/svr4pkg/pkgremove/special.c
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  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  /*
       23 + * Copyright 2017 Gary Mills
  23   24   * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
  24   25   * Use is subject to license terms.
  25   26   */
  26   27  
  27   28  
  28   29  /*
  29   30   * special.c
  30   31   *
  31   32   * This module contains code required to remove special contents from
  32   33   * the contents file when a pkgrm is done on a system upgraded to use
↓ open down ↓ 459 lines elided ↑ open up ↑
 492  493   * Side effects: The contents file may change as a result of this call,
 493  494   *    such that lines in the in the file will be changed or removed.
 494  495   *    If the call fails, a t.contents file may be left behind.  This
 495  496   *    temporary file should be removed subsequently.
 496  497   */
 497  498  int
 498  499  special_contents_remove(int ient, struct cfent **ppcfent, const char *pcroot)
 499  500  {
 500  501          int result = 0;         /* Assume we will succeed.  Return result. */
 501  502          char **ppcSC = NULL;    /* The special contents rules, sorted. */
 502      -        int i, j;               /* Indexes into contents & special contents */
      503 +        int i;                  /* Index into contents & special contents */
 503  504          FILE *fpi = NULL,       /* Input of contents file */
 504  505              *fpo = NULL;        /* Output to temp contents file */
 505  506          char cpath[PATH_MAX],   /* Contents file path */
 506  507              tcpath[PATH_MAX];   /* Temp contents file path */
 507  508          const char *pccontents = "var/sadm/install/contents";
 508  509          const char *pctcontents = "var/sadm/install/t.contents";
 509  510          char line[LINESZ];      /* Reads in and writes out contents lines. */
 510  511          time_t t;               /* Used to create a timestamp comment. */
 511  512          int max;                /* Max number of special contents entries. */
 512  513          int *piIndex;           /* An index to ppcfents to remove from cfile */
↓ open down ↓ 79 lines elided ↑ open up ↑
 592  593           * the ppcfent array which corresponds to an index set to 1.
 593  594           *
 594  595           * These items are the removed package contents which matche an
 595  596           * entry in ppcSC (the special_contents rules).
 596  597           *
 597  598           * Since both the contents and rules are sorted, we can
 598  599           * make a single efficient pass.
 599  600           */
 600  601          (void) memset(line, 0, LINESZ);
 601  602  
 602      -        for (i = 0, j = 0; fgets(line, LINESZ, fpi) != NULL; ) {
      603 +        for (i = 0; fgets(line, LINESZ, fpi) != NULL; ) {
 603  604  
 604  605                  char *pcpath = NULL;
 605  606  
 606  607                  /*
 607  608                   * Note:  This could be done better:  We should figure out
 608  609                   * which are the last 2 lines and only trim those off.
 609  610                   * This will suffice to do this and will only be done as
 610  611                   * part of special_contents handling.
 611  612                   */
 612  613                  if (line[0] == '#')
↓ open down ↓ 98 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX