1942 /*
1943 * Copy non default extended system attributes of named
1944 * attribute file.
1945 */
1946 if (fsetattr(targattrfd,
1947 XATTR_VIEW_READWRITE, res) != 0) {
1948 ++error;
1949 (void) fprintf(stderr, gettext("%s: "
1950 "Failed to copy extended system "
1951 "attributes from attribute file "
1952 "%s of %s to %s\n"), cmd,
1953 dp->d_name, source, target);
1954 }
1955 }
1956 next:
1957 if (srcattrfd != -1)
1958 (void) close(srcattrfd);
1959 if (targattrfd != -1)
1960 (void) close(targattrfd);
1961 srcattrfd = targattrfd = -1;
1962 if (res != NULL)
1963 nvlist_free(res);
1964 }
1965 }
1966 /* Copy source file non default extended system attributes to target */
1967 if (target_sa_support && (response != NULL) &&
1968 (fsetattr(targfd, XATTR_VIEW_READWRITE, response)) != 0) {
1969 ++error;
1970 (void) fprintf(stderr, gettext("%s: Failed to "
1971 "copy extended system attributes from "
1972 "%s to %s\n"), cmd, source, target);
1973 }
1974 out:
1975 if (response != NULL)
1976 nvlist_free(response);
1977 close_all();
1978 return (error == 0 ? 0 : 1);
1979 }
1980
1981 /* Open the source file */
1982
1983 int
1984 open_source(char *src)
1985 {
1986 int error = 0;
1987
1988 srcfd = -1;
1989 if ((srcfd = open(src, O_RDONLY)) == -1) {
1990 if (pflg && attrsilent) {
1991 error++;
1992 goto out;
1993 }
1994 if (!attrsilent) {
1995 (void) fprintf(stderr,
|
1942 /*
1943 * Copy non default extended system attributes of named
1944 * attribute file.
1945 */
1946 if (fsetattr(targattrfd,
1947 XATTR_VIEW_READWRITE, res) != 0) {
1948 ++error;
1949 (void) fprintf(stderr, gettext("%s: "
1950 "Failed to copy extended system "
1951 "attributes from attribute file "
1952 "%s of %s to %s\n"), cmd,
1953 dp->d_name, source, target);
1954 }
1955 }
1956 next:
1957 if (srcattrfd != -1)
1958 (void) close(srcattrfd);
1959 if (targattrfd != -1)
1960 (void) close(targattrfd);
1961 srcattrfd = targattrfd = -1;
1962 nvlist_free(res);
1963 }
1964 }
1965 /* Copy source file non default extended system attributes to target */
1966 if (target_sa_support && (response != NULL) &&
1967 (fsetattr(targfd, XATTR_VIEW_READWRITE, response)) != 0) {
1968 ++error;
1969 (void) fprintf(stderr, gettext("%s: Failed to "
1970 "copy extended system attributes from "
1971 "%s to %s\n"), cmd, source, target);
1972 }
1973 out:
1974 nvlist_free(response);
1975 close_all();
1976 return (error == 0 ? 0 : 1);
1977 }
1978
1979 /* Open the source file */
1980
1981 int
1982 open_source(char *src)
1983 {
1984 int error = 0;
1985
1986 srcfd = -1;
1987 if ((srcfd = open(src, O_RDONLY)) == -1) {
1988 if (pflg && attrsilent) {
1989 error++;
1990 goto out;
1991 }
1992 if (!attrsilent) {
1993 (void) fprintf(stderr,
|