Print this page
12288 getfacl and setfacl could stand improvement

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/getfacl/getfacl.c
          +++ new/usr/src/cmd/getfacl/getfacl.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  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   * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + * Copyright 2020 Peter Tribble.
  24   25   */
  25   26  
  26      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  27      -
  28      -#ifndef lint
  29      -static char sccsid[] = "%Z%%M%  %I%     %E% SMI";
  30      -#endif
  31      -
  32   27  /*
  33   28   * getfacl [-ad] file ...
  34   29   * This command displays discretionary information for a file or files.
  35   30   * display format:
  36   31   *      # file: filename
  37   32   *      # owner: uid
  38   33   *      # group: gid
  39   34   *      user::perm
  40   35   *      user:uid:perm
  41   36   *      group::perm
↓ open down ↓ 24 lines elided ↑ open up ↑
  66   61  
  67   62  int
  68   63  main(int argc, char *argv[])
  69   64  {
  70   65          int             c;
  71   66          int             aflag = 0;
  72   67          int             dflag = 0;
  73   68          int             errflag = 0;
  74   69          int             savecnt;
  75   70          int             aclcnt;
  76      -        int             mask;
       71 +        int             mask = 0;
  77   72          aclent_t        *aclp;
  78   73          aclent_t        *tp;
  79   74          char            *permp;
  80   75  
  81   76          (void) setlocale(LC_ALL, "");
  82   77          (void) textdomain(TEXT_DOMAIN);
  83   78  
  84   79          if (argc < 2)
  85   80                  usage();
  86   81  
↓ open down ↓ 22 lines elided ↑ open up ↑
 109  104                  filep = argv[optind];
 110  105  
 111  106                  /* Get ACL info of the files */
 112  107                  errno = 0;
 113  108                  if ((aclcnt = acl(filep, GETACLCNT, 0, NULL)) < 0) {
 114  109                          if (errno == ENOSYS) {
 115  110                                  (void) fprintf(stderr,
 116  111                                      gettext("File system doesn't support "
 117  112                                      "aclent_t style ACL's.\n"
 118  113                                      "See acl(5) for more information on "
 119      -                                    "Solaris ACL support.\n"));
      114 +                                    "POSIX-draft ACL support.\n"));
 120  115                                  exit(2);
 121  116                          }
 122  117                          perror(filep);
 123  118                          exit(2);
 124  119                  }
 125  120                  if (aclcnt < MIN_ACL_ENTRIES) {
 126  121                          (void) fprintf(stderr,
 127  122                              gettext("%d: acl count too small from %s\n"),
 128  123                              aclcnt, filep);
 129  124                          exit(2);
↓ open down ↓ 211 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX