5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * CDDL HEADER START
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * The contents of this file are subject to the terms of the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Common Development and Distribution License (the "License").
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * You may not use this file except in compliance with the License.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * or http://www.opensolaris.org/os/licensing.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * See the License for the specific language governing permissions
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * and limitations under the License.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * When distributing Covered Code, include this CDDL HEADER in each
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * If applicable, add the following below this CDDL HEADER, with the
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * fields enclosed by brackets "[]" replaced with your own identifying
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * information: Portions Copyright [yyyy] [name of copyright owner]
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * CDDL HEADER END
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * Use is subject to license terms.
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland/* All Rights Reserved */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * consolidation pkg command library includes
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * local pkg command library includes
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * forward declarations
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandstatic int finalck_warning(struct cfent *ept, int attrchg, int contchg);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandstatic int finalck_error(struct cfent *ept, int attrchg, int contchg);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandfinalck(struct cfent *ept, int attrchg, int contchg, boolean_t a_warning)
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * invoke the correct finalck based on whether warnings or errors
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * should be generated
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland errflg = finalck_warning(ept, attrchg, contchg);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland errflg = finalck_error(ept, attrchg, contchg);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* exit debug output */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland echoDebug(DBG_FINALCK_EXIT, errflg, ept->ftype,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* return results of the finalck_xxx call */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * this finalck generates errors on failure
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandfinalck_error(struct cfent *ept, int attrchg, int contchg)
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* entry debug info */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland echoDebug(DBG_FINALCK_ERROR, attrchg, contchg, ept->ftype,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* on attribute or content change, verify attributes */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* verify change, or fix if possible */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland n = averify(1, &ept->ftype, ept->path, &ept->ainfo);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (n != 0) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland return (1); /* no need to check contents */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* on content change of "f/e/v" type, verify contents */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (contchg && strchr("fev", ept->ftype)) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* verify change was executed properly */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland n = cverify(1, &ept->ftype, ept->path, &ept->cinfo, 1);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (n != 0) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland * this finalck generates warnings on failure
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterlandfinalck_warning(struct cfent *ept, int attrchg, int contchg)
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* entry debug info */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland echoDebug(DBG_FINALCK_WARNING, attrchg, contchg, ept->ftype,
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* on attribute or content change, verify attributes */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* verify change, or fix if possible */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland n = averify(1, &ept->ftype, ept->path, &ept->ainfo);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (n != 0) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland return (1); /* no need to check contents */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* on content change of "f/e/v" type, verify contents */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (contchg && strchr("fev", ept->ftype)) {
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland /* verify change was executed properly */
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland n = cverify(1, &ept->ftype, ept->path, &ept->cinfo, 1);
5c51f1241dbbdf2656d0e10011981411ed0c9673Moriah Waterland if (n != 0) {