Print this page
10075 make usr/src/tools smatch clean

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/install.bin/install.bin.c
          +++ new/usr/src/tools/install.bin/install.bin.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  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   * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   */
  24   24  
       25 +/*
       26 + * Copyright (c) 2018, Joyent, Inc.
       27 + */
  25   28  
  26   29  #include <stdio.h>
  27   30  #include <stdlib.h>
  28   31  #include <strings.h>
  29   32  #include <sys/param.h>
  30   33  #include <fcntl.h>
  31   34  #include <sys/errno.h>
  32   35  #include <sys/types.h>
  33   36  #include <sys/uio.h>
  34   37  #include <unistd.h>
↓ open down ↓ 61 lines elided ↑ open up ↑
  96   99  
  97  100  
  98  101  void
  99  102  chown_file(const char *file, const char *group, const char *owner)
 100  103  {
 101  104          gid_t   grp = (gid_t)-1;
 102  105          uid_t   own = (uid_t)-1;
 103  106  
 104  107          if (group) {
 105  108                  grp = stdfind(group, groupnames);
 106      -                if (grp < 0)
      109 +                if (grp == (gid_t)-1)
 107  110                          (void) fprintf(stderr, "unknown group(%s)\n", group);
 108  111          }
 109  112  
 110  113          if (owner) {
 111  114                  own = stdfind(owner, usernames);
 112      -                if (own < 0) {
      115 +                if (own == (uid_t)-1) {
 113  116                          (void) fprintf(stderr, "unknown owner(%s)\n", owner);
 114  117                          exit(1);
 115  118                  }
 116  119  
 117  120          }
 118  121  
 119  122          if (chown(file, own, grp) == -1) {
 120  123                  (void) fprintf(stderr, "install:chown_file: failed "
 121  124                      "(%d): %s\n", errno, strerror(errno));
 122  125                  exit(1);
↓ open down ↓ 124 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX