Print this page
10134 mv needs smatch fixes

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/mv/mv.c
          +++ new/usr/src/cmd/mv/mv.c
↓ open down ↓ 24 lines elided ↑ open up ↑
  25   25  
  26   26  /*
  27   27   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  28   28   * Use is subject to license terms.
  29   29   */
  30   30  
  31   31  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  32   32  /*        All Rights Reserved   */
  33   33  
  34   34  /*
       35 + * Copyright (c) 2018, Joyent, Inc.
       36 + */
       37 +
       38 +/*
  35   39   * University Copyright- Copyright (c) 1982, 1986, 1988
  36   40   * The Regents of the University of California
  37   41   * All Rights Reserved
  38   42   *
  39   43   * University Acknowledgment- Portions of this document are derived from
  40   44   * software developed by the University of California, Berkeley, and its
  41   45   * contributors.
  42   46   */
  43   47  
  44   48  /*
↓ open down ↓ 1887 lines elided ↑ open up ↑
1932 1936                          else if (ret > 0) {
1933 1937                                  ++error;
1934 1938                                  goto out;
1935 1939                          }
1936 1940                          /*
1937 1941                           * Gets non default extended system attributes from the
1938 1942                           * attribute file to copy to the target. The target has
1939 1943                           * the defaults set when its created and thus  no need
1940 1944                           * to copy the defaults.
1941 1945                           */
1942      -                        if (dp->d_name != NULL) {
1943      -                                res = sysattr_list(cmd, srcattrfd, dp->d_name);
1944      -                                if (res == NULL)
1945      -                                        goto next;
     1946 +                        res = sysattr_list(cmd, srcattrfd, dp->d_name);
     1947 +                        if (res == NULL)
     1948 +                                goto next;
1946 1949  
1947 1950                          /*
1948 1951                           * Copy non default extended system attributes of named
1949 1952                           * attribute file.
1950 1953                           */
1951      -                                if (fsetattr(targattrfd,
1952      -                                    XATTR_VIEW_READWRITE, res) != 0) {
1953      -                                        ++error;
1954      -                                        (void) fprintf(stderr, gettext("%s: "
1955      -                                            "Failed to copy extended system "
1956      -                                            "attributes from attribute file "
1957      -                                            "%s of %s to %s\n"), cmd,
1958      -                                            dp->d_name, source, target);
1959      -                                }
     1954 +                        if (fsetattr(targattrfd,
     1955 +                            XATTR_VIEW_READWRITE, res) != 0) {
     1956 +                                ++error;
     1957 +                                (void) fprintf(stderr, gettext("%s: "
     1958 +                                    "Failed to copy extended system "
     1959 +                                    "attributes from attribute file "
     1960 +                                    "%s of %s to %s\n"), cmd,
     1961 +                                    dp->d_name, source, target);
1960 1962                          }
     1963 +
1961 1964  next:
1962 1965                          if (srcattrfd != -1)
1963 1966                                  (void) close(srcattrfd);
1964 1967                          if (targattrfd != -1)
1965 1968                                  (void) close(targattrfd);
1966 1969                          srcattrfd = targattrfd = -1;
1967 1970                          nvlist_free(res);
1968 1971                  }
1969 1972          }
1970 1973          /* Copy source file non default extended system attributes to target */
↓ open down ↓ 290 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX