summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@nexenta.com>2010-11-15 20:03:27 -0800
committerGarrett D'Amore <garrett@nexenta.com>2010-11-15 20:03:27 -0800
commit4656d4747c8743290bfbe910c64cd75eb4e4af8d (patch)
tree241d8b3f0b8796e33937c6a27c670eba002f8f04 /usr
parent60bec29ea42d65ac648c69b0fb189273e286ca57 (diff)
downloadillumos-joyent-4656d4747c8743290bfbe910c64cd75eb4e4af8d.tar.gz
420 remove patch (sparse package) support from svr4 pkg
421 libpkg and libadm need to be lint clean Reviewed by: gwr@nexenta.com Reviewed by: peter.tribble@gmail.com Approved by: gwr@nexenta.com
Diffstat (limited to 'usr')
-rw-r--r--usr/src/Makefile.lint10
-rw-r--r--usr/src/cmd/svr4pkg/hdrs/libinst.h2
-rw-r--r--usr/src/cmd/svr4pkg/hdrs/messages.h3
-rw-r--r--usr/src/cmd/svr4pkg/libinst/dockdeps.c13
-rw-r--r--usr/src/cmd/svr4pkg/pkgadd/main.c59
-rw-r--r--usr/src/cmd/svr4pkg/pkgadm/pkgadm.h5
-rw-r--r--usr/src/cmd/svr4pkg/pkgadm/pkgadm_msgs.h3
-rw-r--r--usr/src/cmd/svr4pkg/pkgcond/main.c20
-rw-r--r--usr/src/cmd/svr4pkg/pkgcond/pkgcond.h2
-rw-r--r--usr/src/cmd/svr4pkg/pkginstall/main.c136
-rw-r--r--usr/src/cmd/svr4pkg/pkginstall/merginfo.c51
-rw-r--r--usr/src/cmd/svr4pkg/pkginstall/quit.c32
-rw-r--r--usr/src/cmd/svr4pkg/pkgremove/check.c21
-rw-r--r--usr/src/head/libzonecfg.h7
-rw-r--r--usr/src/lib/libadm/common/ckdate.c10
-rw-r--r--usr/src/lib/libadm/common/ckitem.c17
-rw-r--r--usr/src/lib/libadm/common/ckpath.c10
-rw-r--r--usr/src/lib/libadm/common/ckstr.c12
-rw-r--r--usr/src/lib/libadm/common/cktime.c14
-rw-r--r--usr/src/lib/libadm/common/getvol.c37
-rw-r--r--usr/src/lib/libadm/common/pkginfo.c13
-rw-r--r--usr/src/lib/libadm/common/pkgparam.c14
-rw-r--r--usr/src/lib/libadm/common/putdev.c36
-rw-r--r--usr/src/lib/libadm/common/putdgrp.c185
-rw-r--r--usr/src/lib/libinstzones/common/instzones_lib.h3
-rw-r--r--usr/src/lib/libinstzones/common/zones.c29
-rw-r--r--usr/src/lib/libinstzones/common/zones_locks.c42
-rw-r--r--usr/src/lib/libinstzones/common/zones_strings.h8
-rw-r--r--usr/src/lib/libinstzones/hdrs/instzones_api.h1
-rw-r--r--usr/src/lib/libpkg/Makefile.com2
-rw-r--r--usr/src/lib/libpkg/common/ckparam.c2
-rw-r--r--usr/src/lib/libpkg/common/dstream.c232
-rw-r--r--usr/src/lib/libpkg/common/gpkglist.c5
-rw-r--r--usr/src/lib/libpkg/common/gpkgmap.c15
-rw-r--r--usr/src/lib/libpkg/common/keystore.c6
-rw-r--r--usr/src/lib/libpkg/common/logerr.c4
-rw-r--r--usr/src/lib/libpkg/common/mapfile-vers2
-rw-r--r--usr/src/lib/libpkg/common/ncgrpw.c40
-rw-r--r--usr/src/lib/libpkg/common/pkgerr.c12
-rw-r--r--usr/src/lib/libpkg/common/pkgexecv.c8
-rw-r--r--usr/src/lib/libpkg/common/pkglib.h102
-rw-r--r--usr/src/lib/libpkg/common/pkglibmsgs.h16
-rw-r--r--usr/src/lib/libpkg/common/pkgmount.c18
-rw-r--r--usr/src/lib/libpkg/common/pkgserv.c3
-rw-r--r--usr/src/lib/libpkg/common/pkgtrans.c260
-rw-r--r--usr/src/lib/libpkg/common/pkgweb.c22
-rw-r--r--usr/src/lib/libpkg/common/pkgxpand.c118
-rw-r--r--usr/src/lib/libpkg/common/ppkgmap.c24
-rw-r--r--usr/src/lib/libpkg/common/progerr.c2
-rw-r--r--usr/src/lib/libpkg/common/putcfile.c4
-rw-r--r--usr/src/lib/libpkg/common/runcmd.c246
-rw-r--r--usr/src/lib/libpkg/common/tputcfent.c10
-rw-r--r--usr/src/lib/libpkg/common/verify.c31
-rw-r--r--usr/src/lib/libpkg/common/vfpops.c2
-rw-r--r--usr/src/lib/libzonecfg/common/libzonecfg.c176
-rw-r--r--usr/src/lib/libzonecfg/common/mapfile-vers2
56 files changed, 521 insertions, 1638 deletions
diff --git a/usr/src/Makefile.lint b/usr/src/Makefile.lint
index 144b315c01..6ccb30c9e4 100644
--- a/usr/src/Makefile.lint
+++ b/usr/src/Makefile.lint
@@ -340,6 +340,7 @@ COMMON_SUBDIRS = \
lib/brand/solaris10 \
lib/crypt_modules \
lib/extendedFILE \
+ lib/libadm \
lib/libadutils \
lib/libadt_jni \
lib/libaio \
@@ -407,6 +408,7 @@ COMMON_SUBDIRS = \
lib/libpctx \
lib/libpicl \
lib/libpicltree \
+ lib/libpkg \
lib/libpool \
lib/libproc \
lib/libpthread \
@@ -475,12 +477,6 @@ COMMON_SUBDIRS = \
ucbcmd/users \
ucbcmd/whoami
-$(CLOSED_BUILD)COMMON_SUBDIRS += \
- $(CLOSED)/cmd/cmd-inet/usr.lib/in.iked \
- $(CLOSED)/cmd/pax \
- $(CLOSED)/cmd/sed_xpg4 \
- $(CLOSED)/lib/libc_i18n
-
i386_SUBDIRS= \
cmd/acpihpd \
cmd/biosdev \
@@ -511,8 +507,6 @@ sparc_SUBDIRS= \
lib/storage \
stand
-$(CLOSED_BUILD)COMMON_SUBDIRS += $(CLOSED)/cmd/mtst
-
LINTSUBDIRS= $(COMMON_SUBDIRS) $($(MACH)_SUBDIRS)
.PARALLEL: $(LINTSUBDIRS)
diff --git a/usr/src/cmd/svr4pkg/hdrs/libinst.h b/usr/src/cmd/svr4pkg/hdrs/libinst.h
index 2e68af845b..38d16018ad 100644
--- a/usr/src/cmd/svr4pkg/hdrs/libinst.h
+++ b/usr/src/cmd/svr4pkg/hdrs/libinst.h
@@ -239,8 +239,6 @@ extern int finalck __P((struct cfent *ept, int attrchg, int contchg,
/* dockdeps.c */
extern void setUpdate __P((void));
extern int isUpdate __P((void));
-extern void setPatchUpdate __P((void));
-extern int isPatchUpdate __P((void));
/* mntinfo.c */
extern int get_mntinfo __P((int map_client, char *vfstab_file));
diff --git a/usr/src/cmd/svr4pkg/hdrs/messages.h b/usr/src/cmd/svr4pkg/hdrs/messages.h
index b7cacff640..67b2f9bf34 100644
--- a/usr/src/cmd/svr4pkg/hdrs/messages.h
+++ b/usr/src/cmd/svr4pkg/hdrs/messages.h
@@ -537,7 +537,6 @@ extern "C" {
#define ERR_OPRESVR4 gettext("unable to unlink options file <%s>")
#define ERR_OUTPUT_WRITING gettext("error while writing file <%s>: (%d) %s")
#define ERR_PACKAGEBINREN gettext("unable to rename <%s>\n\tto <%s>")
-#define ERR_PATCHPKG gettext("unable to update patch_table with patches that have been pre installed")
#define ERR_PATH gettext("the path <%s> is invalid!")
#define ERR_PKGABRV gettext("illegal package abbreviation <%s> in dependency file")
#define ERR_PKGADDCHK_CNFFAILED gettext("Conflicting file dependency checking failed.")
@@ -670,7 +669,6 @@ extern "C" {
#define ERR_WTMPFILE gettext("unable to write temporary file <%s>")
#define ERR_ZONETEMPDIR gettext("unable to make temporary directory for non-global zone operations in directory <%s>: %s")
#define ERR_Z_USED_IN_NONGLOBAL_ZONE gettext("the zonelist option may not be used in a non-global zone")
-#define ERR_PKGINFO_COPY gettext("unable to copy %s to %s")
#define ERR_CANNOT_ENABLE_LOCAL_FS gettext("Failed to enable the filesystem/local service.\n")
#define ERR_CANNOT_RESTORE_LOCAL_FS gettext("Failed to bring the filesystem/local service back to its original state.\n")
@@ -838,7 +836,6 @@ extern "C" {
#define WRN_INSTVOL_NOTDIR gettext("WARNING: %s may not overwrite a populated directory.")
#define WRN_INSTVOL_NOVERIFY gettext("WARNING: %s <cannot install to or verify on %s>")
#define WRN_NOMAIL gettext("WARNING: unable to send e-mail notification")
-#define WRN_PKGREMOVE_PATCHES gettext("\\nWARNING: The following patch(es) are installed to <%s>. If <%s> is removed, the patches applied to it will be removed as well leaving the patch partially installed. It is recommended that the patch(es) be removed before removing <%s>.\\n\\t%s")
#define WRN_RELATIVE gettext("attempting to rename a relative file <%s>")
#define WRN_RSCRIPTALT_BAD gettext("WARNING: the admin parameter <%s> is set to <%s> which is not recognized; the parameter may only be set to <%s> or <%s>")
#define WRN_RSCRIPTALT_USING gettext("WARNING: the admin parameter <%s> is assumed to be set to <%s>")
diff --git a/usr/src/cmd/svr4pkg/libinst/dockdeps.c b/usr/src/cmd/svr4pkg/libinst/dockdeps.c
index e3fd981ffd..7f469f7d72 100644
--- a/usr/src/cmd/svr4pkg/libinst/dockdeps.c
+++ b/usr/src/cmd/svr4pkg/libinst/dockdeps.c
@@ -67,7 +67,6 @@ static int nlist;
static int pkgexist;
static int pkgokay;
static int is_update;
-static int is_patch_update;
/*
* IMPORTANT NOTE: THE SIZE OF 'abbrev' IS HARD CODED INTO THE CHARACTER
@@ -188,18 +187,6 @@ done:
}
void
-setPatchUpdate(void)
-{
- is_patch_update = 1;
-}
-
-int
-isPatchUpdate(void)
-{
- return ((is_patch_update) ? 1 : 0);
-}
-
-void
setUpdate(void)
{
is_update = 1;
diff --git a/usr/src/cmd/svr4pkg/pkgadd/main.c b/usr/src/cmd/svr4pkg/pkgadd/main.c
index a589dd389e..9917fb5253 100644
--- a/usr/src/cmd/svr4pkg/pkgadd/main.c
+++ b/usr/src/cmd/svr4pkg/pkgadd/main.c
@@ -165,10 +165,6 @@ static boolean_t debugFlag = B_FALSE;
static boolean_t globalZoneOnly = B_FALSE;
-/* Set by -O patchPkgRemoval */
-
-static boolean_t patchPkgRemoval = B_FALSE;
-
/*
* Assume the package is ABI and POSIX compliant as regards user
* interactiion during procedure scripts.
@@ -624,27 +620,6 @@ main(int argc, char **argv)
continue;
}
- /*
- * Private interface: package is being
- * installed as a patch package.
- */
-
- if (strcmp(p, "patchPkgInstall") == 0) {
- setPatchUpdate();
- continue;
- }
-
- /*
- * If this is a patch removal
- * then call setPatchUpdate() and set
- * patchPkgRemoval flag.
- */
- if (strcmp(p, "patchPkgRemoval") == 0) {
- setPatchUpdate();
- patchPkgRemoval = B_TRUE;
- continue;
- }
-
if (strncmp(p, "zonelist=", 9) == 0) {
/*
* If colons used as separators,
@@ -1661,16 +1636,6 @@ pkgZoneCheckInstall(char *a_zoneName, zone_state_t a_zoneState,
arg[nargs++] = "-O";
arg[nargs++] = "addzonename";
- if (isPatchUpdate()) {
- if (patchPkgRemoval == B_TRUE) {
- arg[nargs++] = "-O";
- arg[nargs++] = "patchPkgRemoval";
- } else {
- arg[nargs++] = "-O";
- arg[nargs++] = "patchPkgInstall";
- }
- }
-
/*
* add parent zone info/type
*/
@@ -2009,16 +1974,6 @@ pkgZoneInstall(char *a_zoneName, zone_state_t a_zoneState, char *a_idsName,
arg[nargs++] = "-O";
arg[nargs++] = "addzonename";
- if (isPatchUpdate()) {
- if (patchPkgRemoval == B_TRUE) {
- arg[nargs++] = "-O";
- arg[nargs++] = "patchPkgRemoval";
- } else {
- arg[nargs++] = "-O";
- arg[nargs++] = "patchPkgInstall";
- }
- }
-
/*
* add parent zone info/type
*/
@@ -2187,18 +2142,6 @@ pkgInstall(char *a_altRoot, char *a_idsName, char *a_pkgDir, char *a_altBinDir)
arg[nargs++] = "debug";
}
- /* Installation is from a patch package. */
-
- if (isPatchUpdate()) {
- if (patchPkgRemoval == B_TRUE) {
- arg[nargs++] = "-O";
- arg[nargs++] = "patchPkgRemoval";
- } else {
- arg[nargs++] = "-O";
- arg[nargs++] = "patchPkgInstall";
- }
- }
-
arg[nargs++] = "-O";
arg[nargs++] = pkgmodeargument(pkgservergetmode());
@@ -2386,7 +2329,7 @@ pkgInstall(char *a_altRoot, char *a_idsName, char *a_pkgDir, char *a_altBinDir)
arg[nargs++] = a_idsName;
arg[nargs++] = "-p";
ds_close(1);
- ds_putinfo(buffer);
+ ds_putinfo(buffer, sizeof (buffer));
arg[nargs++] = buffer;
} else if (pkgdev.mount != NULL) {
arg[nargs++] = "-d";
diff --git a/usr/src/cmd/svr4pkg/pkgadm/pkgadm.h b/usr/src/cmd/svr4pkg/pkgadm/pkgadm.h
index 5e5c0616b0..8911389517 100644
--- a/usr/src/cmd/svr4pkg/pkgadm/pkgadm.h
+++ b/usr/src/cmd/svr4pkg/pkgadm/pkgadm.h
@@ -28,11 +28,6 @@
#define _PKGADM_H
-/*
- * Module: patchutil.h
- * Description: This module contains the interfaces for patchadd
- */
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/usr/src/cmd/svr4pkg/pkgadm/pkgadm_msgs.h b/usr/src/cmd/svr4pkg/pkgadm/pkgadm_msgs.h
index 4175a5a038..44357630bd 100644
--- a/usr/src/cmd/svr4pkg/pkgadm/pkgadm_msgs.h
+++ b/usr/src/cmd/svr4pkg/pkgadm/pkgadm_msgs.h
@@ -247,9 +247,6 @@ extern "C" {
#define MSG_NOT_READABLE gettext(\
"Operation failed: unable to read file %s")
-#define MSG_PATCH_UPGD gettext(\
- "Operation failed: unable to process patch information\n")
-
#define MSG_BUILD_INDEXES gettext(\
"Operation failed: unable to build indexes\n")
diff --git a/usr/src/cmd/svr4pkg/pkgcond/main.c b/usr/src/cmd/svr4pkg/pkgcond/main.c
index 1b2716c593..2cf036a790 100644
--- a/usr/src/cmd/svr4pkg/pkgcond/main.c
+++ b/usr/src/cmd/svr4pkg/pkgcond/main.c
@@ -148,8 +148,6 @@ struct globalData_t {
long gd_fileSystemConfigLen;
/* current zone name */
char *gd_zoneName;
- /* version of target: PATCH_CLIENT_VERSION */
- char *gd_patchClientVersion;
/* SUNW_PKGCOND_GLOBAL_DATA:parentZone:zoneName */
char *gd_parentZoneName;
/* SUNW_PKGCOND_GLOBAL_DATA:parentZone:zoneType */
@@ -3874,30 +3872,16 @@ parseGlobalData(char *a_envVar, GLOBALDATA_T **r_gdt)
}
/*
- * get package install root. If it doesn't exist check for
- * patch install root (ROOTDIR)
+ * get package install root.
*/
a = getenv(ENV_VAR_PKGROOT);
if ((a != NULL) && (*a != '\0')) {
(*r_gdt)->gd_installRoot = a;
} else {
- a = getenv(ENV_VAR_PATCHROOT);
- if ((a != NULL) && (*a != '\0')) {
- (*r_gdt)->gd_installRoot = a;
- } else {
- (*r_gdt)->gd_installRoot = "/";
- }
+ (*r_gdt)->gd_installRoot = "/";
}
- /*
- * get patch client version: always set if $ROOTDIR != / and
- * the $ROOTDIR/var/sadm/softinfo/INST_RELEASE file exists.
- */
-
- a = getenv(ENV_VAR_PATCH_CLIENTVER);
- (*r_gdt)->gd_patchClientVersion = (a ? a : "");
-
/* get the global data environment variable */
a = getenv(a_envVar);
diff --git a/usr/src/cmd/svr4pkg/pkgcond/pkgcond.h b/usr/src/cmd/svr4pkg/pkgcond/pkgcond.h
index f152be2146..72b27e5ee6 100644
--- a/usr/src/cmd/svr4pkg/pkgcond/pkgcond.h
+++ b/usr/src/cmd/svr4pkg/pkgcond/pkgcond.h
@@ -38,12 +38,10 @@ extern "C" {
/* environment variable */
#define ENV_VAR_DEBUG "PKGCOND_DEBUG"
#define ENV_VAR_PKGROOT "PKG_INSTALL_ROOT"
-#define ENV_VAR_PATCHROOT "ROOTDIR"
#define ENV_VAR_SET "SET_FROM_ENVIRONMENT"
#define ENV_VAR_VERBOSE "PKGCOND_VERBOSE"
#define ENV_VAR_PKGZONENAME "SUNW_PKG_INSTALL_ZONENAME"
#define ENV_VAR_INITIAL_INSTALL "PKG_INIT_INSTALL"
-#define ENV_VAR_PATCH_CLIENTVER "PATCH_CLIENT_VERSION"
/* return codes used with pkgcond itself */
#define R_SUCCESS 0x0 /* condition match / success */
diff --git a/usr/src/cmd/svr4pkg/pkginstall/main.c b/usr/src/cmd/svr4pkg/pkginstall/main.c
index 9a29c051c8..1e6c46cb56 100644
--- a/usr/src/cmd/svr4pkg/pkginstall/main.c
+++ b/usr/src/cmd/svr4pkg/pkginstall/main.c
@@ -181,14 +181,6 @@ static boolean_t debugFlag = B_FALSE;
static boolean_t globalZoneOnly = B_FALSE;
-/* Set by -O patchPkgInstall */
-
-static boolean_t patchPkgInstall = B_FALSE;
-
-/* Set by -O patchPkgRemoval */
-
-static boolean_t patchPkgRemoval = B_FALSE;
-
/* Set by -O preinstallcheck */
static boolean_t preinstallCheck = B_FALSE;
@@ -632,29 +624,6 @@ main(int argc, char *argv[])
continue;
}
- /*
- * If this is a patch installation
- * then call setPatchUpdate().
- */
-
- if (strcmp(p, "patchPkgInstall") == 0) {
- setPatchUpdate();
- patchPkgInstall = B_TRUE;
- continue;
- }
-
- /*
- * If this is a patch removal
- * then call setPatchUpdate() and set
- * patchPkgRemoval flag.
- */
-
- if (strcmp(p, "patchPkgRemoval") == 0) {
- setPatchUpdate();
- patchPkgRemoval = B_TRUE;
- continue;
- }
-
/* process parent-zone-name option */
if (strncmp(p, PARENTZONENAME,
@@ -1438,14 +1407,13 @@ main(int argc, char *argv[])
}
/*
- * Need to force UPDATE to be NULL in case a patch has been applied
- * before creating a zone. Some pkgs (SUNWcsr) already spooled
- * to the zone, check the value of UPDATE in their postinstall script.
- * After a pkg has been patched UPDATE exists statically in the
- * pkginfo file and this value must be reset when installing a zone.
+ * Some pkgs (SUNWcsr) already spooled to the zone, check the
+ * value of UPDATE in their postinstall script. After a pkg
+ * has been patched UPDATE exists statically in the pkginfo
+ * file and this value must be reset when installing a zone.
*/
- if (saveSpoolInstall != 0 && !isPatchUpdate() && !isUpdate()) {
+ if (saveSpoolInstall != 0 && !isUpdate()) {
putparam("UPDATE", "");
}
@@ -2147,7 +2115,7 @@ main(int argc, char *argv[])
*/
rm_icas(pkgbin);
- if ((globalZoneOnly) && (!patchPkgInstall) && (!patchPkgRemoval)) {
+ if (globalZoneOnly) {
boolean_t b;
b = pkgAddPackageToGzonlyList(pkginst, get_inst_root());
if (b == B_FALSE) {
@@ -2535,13 +2503,12 @@ merg_pkginfos(struct cl_attr **pclass, struct cl_attr ***mpclass)
newValue = getenv(param);
/*
- * If zone attributes of patch packages haven't been verified
- * by pdo, if there is no new value, and a zone attribute
+ * If there is no new value, and a zone attribute
* is being changed, it is the same as setting the zone package
* attribute to 'false' - make sure current setting is 'false'.
*/
- if ((patchPkgInstall == B_FALSE) && (newValue == NULL) &&
+ if ((newValue == NULL) &&
(setZoneAttribute == B_TRUE) &&
(strcasecmp(oldValue, "false") != 0)) {
@@ -2570,13 +2537,11 @@ merg_pkginfos(struct cl_attr **pclass, struct cl_attr ***mpclass)
}
/*
- * If zone attributes of patch packages haven't been verified
- * by pdo, check if old and new values differ.
+ * Check if old and new values differ.
* Error if zone parameter
*/
- if ((patchPkgInstall == B_FALSE) &&
- (setZoneAttribute == B_TRUE)) {
+ if (setZoneAttribute == B_TRUE) {
/* illegal change to zone attribute */
progerr(ERR_MERGINFOS_CHANGE_ZONEATTR, pkgName,
@@ -2606,68 +2571,57 @@ merg_pkginfos(struct cl_attr **pclass, struct cl_attr ***mpclass)
}
/*
- * Skip this if() section, if zone attributes of patch packages
- * have been verified by pdo.
+ * verify that no zone attribute has been
+ * set to an invalid value
*/
- if (patchPkgInstall == B_FALSE) {
-
- /*
- * verify that no zone attribute has been
- * set to an invalid value
- */
-
- /* SUNW_PKG_ALLZONES */
+ /* SUNW_PKG_ALLZONES */
- newValue = getenv(PKG_ALLZONES_VARIABLE);
+ newValue = getenv(PKG_ALLZONES_VARIABLE);
- /*
- * complain if setting SUNW_PKG_ALLZONES to other than "false"
- */
+ /*
+ * complain if setting SUNW_PKG_ALLZONES to other than "false"
+ */
- if ((newValue != NULL) && (*SUNW_PKG_ALLZONES == '\0') &&
- (strcasecmp(newValue, "false") != 0)) {
- /* change ALLZONES from "true" to "false" (unset) */
- progerr(ERR_MERGINFOS_SET_ZONEATTR, pkgName,
- pkgVersion, PKG_ALLZONES_VARIABLE, newValue);
- return (1);
- }
+ if ((newValue != NULL) && (*SUNW_PKG_ALLZONES == '\0') &&
+ (strcasecmp(newValue, "false") != 0)) {
+ /* change ALLZONES from "true" to "false" (unset) */
+ progerr(ERR_MERGINFOS_SET_ZONEATTR, pkgName,
+ pkgVersion, PKG_ALLZONES_VARIABLE, newValue);
+ return (1);
+ }
- /* SUNW_PKG_THISZONE */
+ /* SUNW_PKG_THISZONE */
- newValue = getenv(PKG_THISZONE_VARIABLE);
+ newValue = getenv(PKG_THISZONE_VARIABLE);
- /*
- * complain if setting SUNW_PKG_THISZONE to other than "false"
- */
-
- if ((newValue != NULL) && (*SUNW_PKG_THISZONE == '\0') &&
- (strcasecmp(newValue, "false") != 0)) {
- /* change THISZONE from "true" to "false" (unset) */
- progerr(ERR_MERGINFOS_SET_ZONEATTR, pkgName,
- pkgVersion, PKG_THISZONE_VARIABLE, newValue);
- return (1);
- }
+ /*
+ * complain if setting SUNW_PKG_THISZONE to other than "false"
+ */
- /* SUNW_PKG_HOLLOW */
+ if ((newValue != NULL) && (*SUNW_PKG_THISZONE == '\0') &&
+ (strcasecmp(newValue, "false") != 0)) {
+ /* change THISZONE from "true" to "false" (unset) */
+ progerr(ERR_MERGINFOS_SET_ZONEATTR, pkgName,
+ pkgVersion, PKG_THISZONE_VARIABLE, newValue);
+ return (1);
+ }
- newValue = getenv(PKG_HOLLOW_VARIABLE);
+ /* SUNW_PKG_HOLLOW */
- /* complain if setting SUNW_PKG_HOLLOW to other than "false" */
+ newValue = getenv(PKG_HOLLOW_VARIABLE);
- if ((newValue != NULL) && (*SUNW_PKG_HOLLOW == '\0') &&
- (strcasecmp(newValue, "false") != 0)) {
- /* change HOLLOW from "true" to 'false" (unset) */
- progerr(ERR_MERGINFOS_SET_ZONEATTR, pkgName,
- pkgVersion, PKG_HOLLOW_VARIABLE, newValue);
- return (1);
- }
+ /* complain if setting SUNW_PKG_HOLLOW to other than "false" */
+ if ((newValue != NULL) && (*SUNW_PKG_HOLLOW == '\0') &&
+ (strcasecmp(newValue, "false") != 0)) {
+ /* change HOLLOW from "true" to 'false" (unset) */
+ progerr(ERR_MERGINFOS_SET_ZONEATTR, pkgName,
+ pkgVersion, PKG_HOLLOW_VARIABLE, newValue);
+ return (1);
}
- /* return */
-
echoDebug(DBG_MERGINFOS_EXIT, pkginfo_path, 0);
return (0);
diff --git a/usr/src/cmd/svr4pkg/pkginstall/merginfo.c b/usr/src/cmd/svr4pkg/pkginstall/merginfo.c
index 2455f29baa..b0ca2aedcc 100644
--- a/usr/src/cmd/svr4pkg/pkginstall/merginfo.c
+++ b/usr/src/cmd/svr4pkg/pkginstall/merginfo.c
@@ -421,9 +421,8 @@ merginfo(struct cl_attr **pclass, int install_from_pspool)
}
if ((strncmp(ep, "UPDATE=", 7) == 0) &&
- install_from_pspool != 0 &&
- !isPatchUpdate() &&
- !isUpdate()) {
+ install_from_pspool != 0 &&
+ !isUpdate()) {
continue;
}
@@ -488,8 +487,7 @@ merginfo(struct cl_attr **pclass, int install_from_pspool)
quit(1);
}
- if (((pdirfp = opendir(path)) != NULL) &&
- !isPatchUpdate()) {
+ if ((pdirfp = opendir(path)) != NULL) {
struct dirent *dp;
@@ -559,30 +557,23 @@ merginfo(struct cl_attr **pclass, int install_from_pspool)
quit(99);
}
- /*
- * Only want to copy the FCS pkgmap if this is not a
- * patch installation.
- */
-
- if (!isPatchUpdate()) {
- i = snprintf(path, sizeof (path), "%s/pkgmap", instdir);
- if (i > sizeof (path)) {
- progerr(ERR_CREATE_PATH_2, instdir, "pkgmap");
- quit(1);
- }
+ i = snprintf(path, sizeof (path), "%s/pkgmap", instdir);
+ if (i > sizeof (path)) {
+ progerr(ERR_CREATE_PATH_2, instdir, "pkgmap");
+ quit(1);
+ }
- i = snprintf(temp, sizeof (temp), "%s/pkgmap",
- saveSpoolInstallDir);
- if (i > sizeof (path)) {
- progerr(ERR_CREATE_PATH_2, saveSpoolInstallDir,
- "pkgmap");
- quit(1);
- }
+ i = snprintf(temp, sizeof (temp), "%s/pkgmap",
+ saveSpoolInstallDir);
+ if (i > sizeof (path)) {
+ progerr(ERR_CREATE_PATH_2, saveSpoolInstallDir,
+ "pkgmap");
+ quit(1);
+ }
- if (cppath(MODE_SRC, path, temp, 0644)) {
- progerr(ERR_CANNOT_COPY, path, temp);
- quit(99);
- }
+ if (cppath(MODE_SRC, path, temp, 0644)) {
+ progerr(ERR_CANNOT_COPY, path, temp);
+ quit(99);
}
}
@@ -602,11 +593,9 @@ merginfo(struct cl_attr **pclass, int install_from_pspool)
quit(1);
}
- if ((stat(path, &status) == 0) &&
- (status.st_mode & S_IFDIR) &&
- !isPatchUpdate()) {
+ if ((stat(path, &status) == 0) && (status.st_mode & S_IFDIR)) {
i = snprintf(cmd, sizeof (cmd), "cp -pr %s/* %s",
- path, pkgsav);
+ path, pkgsav);
if (i > sizeof (cmd)) {
progerr(ERR_SNPRINTF, "cp -pr %s/* %s");
quit(1);
diff --git a/usr/src/cmd/svr4pkg/pkginstall/quit.c b/usr/src/cmd/svr4pkg/pkginstall/quit.c
index af62f4fcfa..664de95126 100644
--- a/usr/src/cmd/svr4pkg/pkginstall/quit.c
+++ b/usr/src/cmd/svr4pkg/pkginstall/quit.c
@@ -67,7 +67,6 @@ extern char pkgloc_sav[];
extern char *msgtext;
extern char *pkginst;
extern char *pkgname;
-extern char saveSpoolInstallDir[]; /* pkginstall/main.c */
/*
* exported functions
@@ -238,9 +237,6 @@ quitSetSilentExit(boolean_t a_silentExit)
void
quit(int retcode)
{
- char orig_pkginfo_path[PATH_MAX];
- char pkginfo_path[PATH_MAX];
-
/* disable interrupts */
(void) signal(SIGINT, SIG_IGN);
@@ -359,34 +355,6 @@ quit(int retcode)
(void) rrmdir(pkgloc_sav);
}
}
-
- if (isPatchUpdate()) {
- if (pkgloc[0] && !access(pkgloc, F_OK) &&
- !access(saveSpoolInstallDir, F_OK)) {
- /*
- * Copy the pkginfo file to the pspool
- * directory. This propagates patch
- * info to the patched pkg in the local
- * zone.
- */
- (void) snprintf(orig_pkginfo_path,
- sizeof (orig_pkginfo_path),
- "%s/%s/%s", get_PKGLOC(),
- pkginst, PKGINFO);
-
- (void) snprintf(pkginfo_path,
- sizeof (pkginfo_path), "%s/%s",
- saveSpoolInstallDir, PKGINFO);
-
- if (cppath(MODE_SET|DIR_DISPLAY,
- orig_pkginfo_path, pkginfo_path,
- 0644)) {
- progerr(ERR_PKGINFO_COPY,
- orig_pkginfo_path,
- pkginfo_path);
- }
- }
- }
}
/*
diff --git a/usr/src/cmd/svr4pkg/pkgremove/check.c b/usr/src/cmd/svr4pkg/pkgremove/check.c
index 75fbc21fdd..a013c4cf02 100644
--- a/usr/src/cmd/svr4pkg/pkgremove/check.c
+++ b/usr/src/cmd/svr4pkg/pkgremove/check.c
@@ -149,27 +149,6 @@ rckrunlevel(void)
}
int
-rckpatchpkg(char *p, char *pt)
-{
- int n;
- char ans[MAX_INPUT];
-
- ptext(stderr, WRN_PKGREMOVE_PATCHES, p, p, p, pt);
-
- n = ckyorn(ans, NULL, NULL, NULL, ASK_PKGREMOVE_CONTINUE);
-
- if (n != 0) {
- return (n);
- }
-
- if (strchr("yY", *ans) == NULL) {
- return (3);
- }
-
- return (0);
-}
-
-int
rckdepend(void)
{
int n;
diff --git a/usr/src/head/libzonecfg.h b/usr/src/head/libzonecfg.h
index ad8d6d2298..d41dbb0520 100644
--- a/usr/src/head/libzonecfg.h
+++ b/usr/src/head/libzonecfg.h
@@ -239,10 +239,6 @@ struct zone_pkgtab {
char zone_pkg_version[ZONE_PKG_VERSMAX];
};
-struct zone_patchtab {
- char zone_patch_id[MAXNAMELEN];
-};
-
struct zone_devpermtab {
char zone_devperm_name[MAXPATHLEN];
uid_t zone_devperm_uid;
@@ -266,7 +262,6 @@ typedef struct {
uu_avl_node_t zpe_entry;
char *zpe_name;
char *zpe_vers;
- uu_avl_t *zpe_patches_avl;
} zone_pkg_entry_t;
typedef enum zone_iptype {
@@ -462,8 +457,6 @@ extern int zonecfg_devperms_apply(zone_dochandle_t, const char *,
uid_t, gid_t, mode_t, const char *);
extern void zonecfg_set_swinv(zone_dochandle_t);
extern int zonecfg_add_pkg(zone_dochandle_t, char *, char *);
-extern int zonecfg_add_patch(zone_dochandle_t, char *, void **);
-extern int zonecfg_add_patch_obs(char *, void *);
/*
* External zone verification support.
diff --git a/usr/src/lib/libadm/common/ckdate.c b/usr/src/lib/libadm/common/ckdate.c
index 2b61fbed54..7c0db59beb 100644
--- a/usr/src/lib/libadm/common/ckdate.c
+++ b/usr/src/lib/libadm/common/ckdate.c
@@ -71,11 +71,11 @@ static char *p_dlm(char *, char);
#define TAB ' '
static void
-setmsg(char *msg, char *fmt)
+setmsg(char *msg, char *fmt, size_t sz)
{
if ((fmt == NULL) || strcmp(fmt, "%D") == 0)
fmt = "%m/%d/%y";
- (void) sprintf(msg, "%s. Format is <%s>.", MESG, fmt);
+ (void) snprintf(msg, sz, "%s. Format is <%s>.", MESG, fmt);
}
static char *
@@ -234,7 +234,7 @@ ckdate_err(char *fmt, char *error)
if ((fmt != NULL) && (fmtcheck(fmt) == 1))
return (4);
- setmsg(defmesg, fmt);
+ setmsg(defmesg, fmt, MSGSIZ);
puterror(stdout, defmesg, error);
return (0);
}
@@ -246,7 +246,7 @@ ckdate_hlp(char *fmt, char *help)
if ((fmt != NULL) && (fmtcheck(fmt) == 1))
return (4);
- setmsg(defmesg, fmt);
+ setmsg(defmesg, fmt, MSGSIZ);
puthelp(stdout, defmesg, help);
return (0);
}
@@ -416,7 +416,7 @@ ckdate(char *date, char *fmt, char *defstr, char *error, char *help,
if ((fmt != NULL) && (fmtcheck(fmt) == 1))
return (4);
- setmsg(defmesg, fmt);
+ setmsg(defmesg, fmt, MSGSIZ);
(void) sprintf(ept, "[?,q]");
if (!prompt)
diff --git a/usr/src/lib/libadm/common/ckitem.c b/usr/src/lib/libadm/common/ckitem.c
index 8835f6b23b..d87c51f2c5 100644
--- a/usr/src/lib/libadm/common/ckitem.c
+++ b/usr/src/lib/libadm/common/ckitem.c
@@ -27,8 +27,10 @@
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ */
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.4 */
/*LINTLIBRARY*/
#include <stdio.h>
@@ -463,6 +465,7 @@ printmenu(CKMENU *menup)
for (i = 1; chp; ++i) {
if (!(menup->attr & CKUNNUM))
(void) fprintf(stderr, "%3d ", i);
+ /* LINTED E_SEC_PRINTF_VAR_FMT */
(void) fprintf(stderr, format, chp->token);
if (chp->text) {
/* there is text associated with the token */
@@ -473,6 +476,7 @@ printmenu(CKMENU *menup)
if (!(menup->attr & CKUNNUM))
(void) fprintf(stderr,
"%5s", "");
+ /* LINTED E_SEC_PRINTF_VAR_FMT */
(void) fprintf(stderr, format, "");
while (isspace((unsigned char)*pt))
++pt;
@@ -505,17 +509,16 @@ static int
getstr(char *strval, char *defstr, char *error, char *help, char *prompt)
{
char input[MAX_INPUT];
- char *ept, end[MAX_INPUT];
+ char end[MAX_INPUT];
- *(ept = end) = '\0';
+ *end = '\0';
if (defstr) {
- (void) sprintf(ept, "(default: %s) ", defstr);
- ept += strlen(ept);
+ (void) snprintf(end, MAX_INPUT, "(default: %s) ", defstr);
}
if (ckquit) {
- (void) strcat(ept, "[?,??,q]");
+ (void) strlcat(end, "[?,??,q]", MAX_INPUT);
} else {
- (void) strcat(ept, "[?,??]");
+ (void) strlcat(end, "[?,??]", MAX_INPUT);
}
start:
diff --git a/usr/src/lib/libadm/common/ckpath.c b/usr/src/lib/libadm/common/ckpath.c
index c5ce5b9f15..b005c754a6 100644
--- a/usr/src/lib/libadm/common/ckpath.c
+++ b/usr/src/lib/libadm/common/ckpath.c
@@ -27,8 +27,10 @@
* Copyright (c) 1996-1998, 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ */
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
/*LINTLIBRARY*/
#include <stdio.h>
@@ -244,7 +246,8 @@ ckpath_err(int pflags, char *error, char *input)
if (input) {
if (ckpath_val(input, pflags)) {
- (void) sprintf(buffer, "Pathname %s.", errstr);
+ (void) snprintf(buffer, sizeof (buffer),
+ "Pathname %s.", errstr);
puterror(stdout, buffer, error);
return;
}
@@ -311,7 +314,8 @@ start:
}
if (ckpath_val(input, pflags)) {
- (void) sprintf(buffer, "Pathname %s.", errstr);
+ (void) snprintf(buffer, sizeof (buffer),
+ "Pathname %s.", errstr);
puterror(stderr, buffer, error);
goto start;
}
diff --git a/usr/src/lib/libadm/common/ckstr.c b/usr/src/lib/libadm/common/ckstr.c
index e01717f233..b72d6900b0 100644
--- a/usr/src/lib/libadm/common/ckstr.c
+++ b/usr/src/lib/libadm/common/ckstr.c
@@ -28,8 +28,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <string.h>
#include <limits.h>
@@ -50,14 +48,14 @@ extern int __step(const char *, const char *);
#define ERRMSG2 \
"Pattern matching has failed."
#define ERRMSG3 \
- "Please enter a string which contains no imbedded, \
+ "Please enter a string which contains no embedded, \
leading or trailing spaces or tabs."
#define HLPMSG0 "Please enter a string"
#define HLPMSG1 "Please enter a string containing no more than %d characters"
#define HLPMSG2 "matches one of the following patterns:"
#define HLPMSG3 "matches the following pattern:"
-#define HLPMSG4 "contains no imbedded, leading or trailing spaces or tabs."
+#define HLPMSG4 "contains no embedded, leading or trailing spaces or tabs."
static char *errstr;
@@ -119,7 +117,8 @@ ckstr_err(char *regexp[], int length, char *error, char *input)
if (input) {
if (ckstr_val(regexp, length, input)) {
- (void) sprintf(temp, errstr, length);
+ /* LINTED E_SEC_PRINTF_VAR_FMT */
+ (void) snprintf(temp, sizeof (temp), errstr, length);
puterror(stdout, temp, error);
return;
}
@@ -178,7 +177,8 @@ start:
return (3);
}
if (ckstr_val(regexp, length, input)) {
- (void) sprintf(errbuf, errstr, length);
+ /* LINTED E_SEC_PRINTF_VAR_FMT */
+ (void) snprintf(errbuf, sizeof (errbuf), errstr, length);
puterror(stderr, errbuf, error);
goto start;
}
diff --git a/usr/src/lib/libadm/common/cktime.c b/usr/src/lib/libadm/common/cktime.c
index 71a5580600..27bdffe9ed 100644
--- a/usr/src/lib/libadm/common/cktime.c
+++ b/usr/src/lib/libadm/common/cktime.c
@@ -27,8 +27,10 @@
* Copyright (c) 1997,1998 by Sun Microsystems, Inc.
* All rights reserved.
*/
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ */
-#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
#include <stdio.h>
@@ -58,11 +60,11 @@ static int fmtcheck(char *);
#define TAB ' '
static void
-setmsg(char *msg, char *fmt)
+setmsg(char *msg, char *fmt, size_t sz)
{
if (fmt == NULL)
fmt = DEFAULT;
- (void) sprintf(msg, "%s <%s>.", ERRMSG, fmt);
+ (void) snprintf(msg, sz, "%s <%s>.", ERRMSG, fmt);
}
static char *
@@ -281,7 +283,7 @@ cktime_err(char *fmt, char *error)
if ((fmt != NULL) && (fmtcheck(fmt) == 1))
return (4);
- setmsg(defmesg, fmt);
+ setmsg(defmesg, fmt, sizeof (defmesg));
puterror(stdout, defmesg, error);
return (0);
}
@@ -293,7 +295,7 @@ cktime_hlp(char *fmt, char *help)
if ((fmt != NULL) && (fmtcheck(fmt) == 1))
return (4);
- setmsg(defmesg, fmt);
+ setmsg(defmesg, fmt, sizeof (defmesg));
puthelp(stdout, defmesg, help);
return (0);
}
@@ -355,7 +357,7 @@ cktime(char *tod, char *fmt, char *defstr, char *error, char *help,
if (fmt == NULL)
fmt = DEFAULT;
- setmsg(defmesg, fmt);
+ setmsg(defmesg, fmt, sizeof (defmesg));
if (!prompt)
prompt = "Enter a time of day";
diff --git a/usr/src/lib/libadm/common/getvol.c b/usr/src/lib/libadm/common/getvol.c
index f4955073ed..df826fcacc 100644
--- a/usr/src/lib/libadm/common/getvol.c
+++ b/usr/src/lib/libadm/common/getvol.c
@@ -28,7 +28,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
#include <stdio.h>
@@ -196,7 +195,7 @@ ckilabel(char *label, int flag)
} else
volname[0] = '\0';
- (void) sprintf(buffer, "/etc/labelit %s", cdevice);
+ (void) snprintf(buffer, sizeof (buffer), "/etc/labelit %s", cdevice);
pp = popen(buffer, "r");
pt = buffer;
while ((c = getc(pp)) != EOF)
@@ -229,6 +228,7 @@ ckilabel(char *label, int flag)
if (strcmp(fsname, pfsname) || strcmp(volname, pvolname)) {
/* mismatched label */
if (flag) {
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
(void) sprintf(label, "%s,%s", pfsname, pvolname);
} else {
labelerr(pfsname, pvolname);
@@ -260,17 +260,20 @@ wilabel(char *label)
(void) strcpy(volname, origvolname);
if (IFTAPE(cdevice)) {
- (void) sprintf(buffer, "/etc/labelit %s \"%s\" \"%s\" -n 1>&2",
+ (void) snprintf(buffer, sizeof (buffer),
+ "/etc/labelit %s \"%s\" \"%s\" -n 1>&2",
cdevice, fsname, volname);
} else {
- (void) sprintf(buffer, "/etc/labelit %s \"%s\" \"%s\" 1>&2",
- cdevice, fsname, volname);
+ (void) snprintf(buffer, sizeof (buffer),
+ "/etc/labelit %s \"%s\" \"%s\" 1>&2",
+ cdevice, fsname, volname);
}
if (system(buffer)) {
(void) fprintf(stderr, "\nWrite of label to %s failed.", pname);
return (1);
}
if (label)
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
(void) sprintf(label, "%s,%s", fsname, volname);
return (0);
}
@@ -300,7 +303,7 @@ insert(char *device, char *label, int options, char *prompt)
dev_type = devattr(device, "type");
if (prompt) {
- (void) strcpy(prmpt, prompt);
+ (void) strlcpy(prmpt, prompt, sizeof (prmpt));
for (pt = prmpt; *prompt; ) {
if ((*prompt == '\\') && (prompt[1] == '%'))
prompt++;
@@ -326,17 +329,21 @@ insert(char *device, char *label, int options, char *prompt)
}
*pt = '\0';
} else {
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
(void) sprintf(prmpt, "Insert a %s into %s.", voltxt, pname);
if (label && (options & DM_ELABEL)) {
(void) strcat(prmpt, " The following external label ");
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
(void) sprintf(prmpt+strlen(prmpt),
" should appear on the %s:\\n\\t%s",
voltxt, label);
}
if (label && !(options & DM_ELABEL)) {
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
(void) sprintf(prmpt+strlen(prmpt),
- " The %s should be internally labeled as follows:",
- voltxt);
+ " The %s should be internally labeled as follows:",
+ voltxt);
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
(void) sprintf(prmpt+strlen(prmpt),
"\\n\\t%s\\n", label);
}
@@ -350,23 +357,28 @@ insert(char *device, char *label, int options, char *prompt)
if (options & DM_FORMFS) {
if (fmtcmd && *fmtcmd && mkfscmd && *mkfscmd) {
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
pt += sprintf(pt, FORMFS_MSG, voltxt);
keyword[n++] = "f";
} else if (fmtcmd && *fmtcmd) {
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
pt += sprintf(pt, FORMAT_MSG, voltxt);
keyword[n++] = "f";
}
if (mkfscmd && *mkfscmd) {
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
pt += sprintf(pt, MAKEFS_MSG, voltxt);
keyword[n++] = "m";
}
} else if (options & DM_FORMAT) {
if (fmtcmd && *fmtcmd) {
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
pt += sprintf(pt, FORMAT_MSG, voltxt);
keyword[n++] = "f";
}
}
if (options & DM_WLABEL) {
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
pt += sprintf(pt, WLABEL_MSG, voltxt);
keyword[n++] = "w";
}
@@ -376,9 +388,11 @@ insert(char *device, char *label, int options, char *prompt)
}
if (removecmd && *removecmd && dev_type && *dev_type) {
if (strcmp(dev_type, "diskette") == 0) {
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
pt += sprintf(pt, EJECT_MSG, voltxt);
keyword[n++] = "e";
} else {
+ /* LINTED E_SEC_SPRINTF_UNBOUNDED_COPY */
pt += sprintf(pt, UNLOAD_MSG, voltxt);
keyword[n++] = "u";
}
@@ -425,7 +439,7 @@ doformat(char *voltxt, char *fmtcmd, char *mkfscmd)
if (fmtcmd && *fmtcmd) {
(void) fprintf(stderr, "\t[%s]\n", fmtcmd);
- (void) sprintf(buffer, "(%s) 1>&2", fmtcmd);
+ (void) snprintf(buffer, sizeof (buffer), "(%s) 1>&2", fmtcmd);
if (system(buffer)) {
(void) fprintf(stderr, ERR_FMT, voltxt);
return;
@@ -433,7 +447,7 @@ doformat(char *voltxt, char *fmtcmd, char *mkfscmd)
}
if (mkfscmd && *mkfscmd) {
(void) fprintf(stderr, "\t[%s]\n", mkfscmd);
- (void) sprintf(buffer, "(%s) 1>&2", mkfscmd);
+ (void) snprintf(buffer, sizeof (buffer), "(%s) 1>&2", mkfscmd);
if (system(buffer)) {
(void) fprintf(stderr, ERR_MKFS, voltxt);
return;
@@ -452,7 +466,8 @@ doremovecmd(char *device, int echo)
if (removecmd && *removecmd) {
if (echo)
(void) fprintf(stderr, "\t[%s]\n", removecmd);
- (void) sprintf(buffer, "(%s) 1>&2", removecmd);
+ (void) snprintf(buffer, sizeof (buffer),
+ "(%s) 1>&2", removecmd);
if (system(buffer)) {
if (echo)
(void) fprintf(stderr, ERR_REMOVE,
diff --git a/usr/src/lib/libadm/common/pkginfo.c b/usr/src/lib/libadm/common/pkginfo.c
index c6f165a531..1d36c06b1c 100644
--- a/usr/src/lib/libadm/common/pkginfo.c
+++ b/usr/src/lib/libadm/common/pkginfo.c
@@ -251,11 +251,13 @@ rdconfig(struct pkginfo *info, char *pkginst, char *ckvers)
PI_INSTALLED);
if (info->status == PI_INSTALLED) {
- (void) sprintf(temp, "%s/%s/!I-Lock!", pkgdir, pkginst);
+ (void) snprintf(temp, sizeof (temp),
+ "%s/%s/!I-Lock!", pkgdir, pkginst);
if (access(temp, 0) == 0)
info->status = PI_PARTIAL;
else {
- (void) sprintf(temp, "%s/%s/!R-Lock!", pkgdir, pkginst);
+ (void) snprintf(temp, sizeof (temp),
+ "%s/%s/!R-Lock!", pkgdir, pkginst);
if (access(temp, 0) == 0)
info->status = PI_PARTIAL;
}
@@ -287,7 +289,7 @@ fpkginst(char *pkg, ...)
static char pkginst[PKGSIZ+1];
static DIR *pdirfp;
struct dirent64 *dp;
- char *pt, *ckarch, *ckvers;
+ char *ckarch, *ckvers;
va_list ap;
va_start(ap, pkg);
@@ -376,7 +378,8 @@ compver(char *pkginst, char *version)
FILE *fp;
char temp[256];
- (void) sprintf(temp, "%s/%s/install/compver", get_PKGLOC(), pkginst);
+ (void) snprintf(temp, sizeof (temp),
+ "%s/%s/install/compver", get_PKGLOC(), pkginst);
if ((fp = fopen(temp, "r")) == NULL)
return (-1);
@@ -424,7 +427,7 @@ ckinfo(char *inst, char *arch, char *vers)
char *pt, *copy, *value, *myarch, *myvers;
int errflg;
- (void) sprintf(file, "%s/%s/pkginfo", pkgdir, inst);
+ (void) snprintf(file, sizeof (file), "%s/%s/pkginfo", pkgdir, inst);
if ((fp = fopen(file, "r")) == NULL)
return (1);
diff --git a/usr/src/lib/libadm/common/pkgparam.c b/usr/src/lib/libadm/common/pkgparam.c
index d43f717554..cd7cacfd27 100644
--- a/usr/src/lib/libadm/common/pkgparam.c
+++ b/usr/src/lib/libadm/common/pkgparam.c
@@ -26,6 +26,10 @@
* Use is subject to license terms.
*/
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ */
+
/*LINTLIBRARY*/
/* 5-20-92 newroot support added */
@@ -390,12 +394,14 @@ void
set_PKGpaths(char *path)
{
if (path && *path) {
- (void) sprintf(Adm_pkgloc, "%s%s", path, PKGLOC);
- (void) sprintf(Adm_pkgadm, "%s%s", path, PKGADM);
+ (void) snprintf(Adm_pkgloc, sizeof (Adm_pkgloc),
+ "%s%s", path, PKGLOC);
+ (void) snprintf(Adm_pkgadm, sizeof (Adm_pkgadm),
+ "%s%s", path, PKGADM);
set_install_root(path);
} else {
- (void) sprintf(Adm_pkgloc, "%s", PKGLOC);
- (void) sprintf(Adm_pkgadm, "%s", PKGADM);
+ (void) snprintf(Adm_pkgloc, sizeof (Adm_pkgloc), "%s", PKGLOC);
+ (void) snprintf(Adm_pkgadm, sizeof (Adm_pkgadm), "%s", PKGADM);
}
canonize_name(Adm_pkgloc);
canonize_name(Adm_pkgadm);
diff --git a/usr/src/lib/libadm/common/putdev.c b/usr/src/lib/libadm/common/putdev.c
index 5d0e7dc562..8ca5bd50cb 100644
--- a/usr/src/lib/libadm/common/putdev.c
+++ b/usr/src/lib/libadm/common/putdev.c
@@ -26,8 +26,10 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ */
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
/* LINTLIBRARY */
/*
@@ -78,12 +80,9 @@
*
* TDTABNM Name of the temporary device table (in the
* directory of the existing table)
- * TDTABNMLN Number of characters added to the directory
- * name -- the length of the device table temp name
*/
#define TDTABNM "%sdevtab.%6.6d"
-#define TDTABNMLN 13
/*
@@ -190,21 +189,20 @@ opennewdevtab(char **pname) /* A(ptr to temp filename's path) */
*(p+1) = '\0';
dirname = oldname;
} else dirname = "./";
- if (buf = malloc(TDTABNMLN + strlen(dirname) + 1)) {
-
- /*
- * Build the name of the temp device table and open the
- * file. We must reset the owner, group and perms to those
- * of the original devtab file.
- */
- (void) sprintf(buf, TDTABNM, dirname, getpid());
- if (fp = fopen(buf, "w")) {
- *pname = buf;
- (void) fchmod(fileno(fp), sbuf.st_mode & 0777);
- (void) fchown(fileno(fp), sbuf.st_uid, sbuf.st_gid);
- } else {
- free(buf);
- }
+ if (asprintf(&buf, TDTABNM, dirname, getpid()) >= 0) {
+
+ /*
+ * Build the name of the temp device table and
+ * open the file. We must reset the owner, group
+ * and perms to those of the original devtab file.
+ */
+ if (fp = fopen(buf, "w")) {
+ *pname = buf;
+ (void) fchmod(fileno(fp), sbuf.st_mode & 0777);
+ (void) fchown(fileno(fp), sbuf.st_uid, sbuf.st_gid);
+ } else {
+ free(buf);
+ }
}
/*
diff --git a/usr/src/lib/libadm/common/putdgrp.c b/usr/src/lib/libadm/common/putdgrp.c
index 856a69468a..c103e0ebcf 100644
--- a/usr/src/lib/libadm/common/putdgrp.c
+++ b/usr/src/lib/libadm/common/putdgrp.c
@@ -26,8 +26,10 @@
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
+/*
+ * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ */
-#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.2 */
/* LINTLIBRARY */
/*
@@ -74,12 +76,9 @@
* L O C A L D E F I N I T I O N S
* TDGTABNM Name of the temporary device-group table (in the
* directory of the existing table)
- * TDGTABNMLN Number of characters added to the directory
- * name -- the length of the device-group table temp name
*/
#define TDGTABNM "%sdgroup.%6.6d"
-#define TDGTABNMLN 13
/*
@@ -137,49 +136,51 @@ opennewdgrptab(char **pname) /* A(ptr to temp filename's path) */
/* Get the name of the device-group table */
if (oldname = _dgrptabpath()) {
- /*
- * It is possible for us to have sufficient permissions to create
- * the new file without having sufficient permissions to write the
- * original dgrptab file. For consistency with the operations which
- * modify the original file by writing it directly we require write
- * permissions for the original file in order to make a new one.
- */
- if ((fd = open(oldname, O_WRONLY)) == -1)
- return (NULL);
+ /*
+ * It is possible for us to have sufficient
+ * permissions to create the new file without having
+ * sufficient permissions to write the original
+ * dgrptab file. For consistency with the operations
+ * which modify the original file by writing it
+ * directly we require write permissions for the
+ * original file in order to make a new one.
+ */
+ if ((fd = open(oldname, O_WRONLY)) == -1)
+ return (NULL);
- if (fstat64(fd, &sbuf) == -1) {
+ if (fstat64(fd, &sbuf) == -1) {
+ (void) close(fd);
+ return (NULL);
+ }
(void) close(fd);
- return (NULL);
- }
- (void) close(fd);
-
- /* Get the directory that the device-group table lives in */
- if (p = strrchr(oldname, '/')) {
- *(p+1) = '\0';
- dirname = oldname;
- } else
- dirname = "./";
- /* Get space for the temp dgrptab pathname */
- if (buf = malloc(TDGTABNMLN+strlen(dirname)+1)) {
+ /* Get the directory that the device-group table lives in */
+ if (p = strrchr(oldname, '/')) {
+ *(p+1) = '\0';
+ dirname = oldname;
+ } else
+ dirname = "./";
- /*
- * Build the name of the temp dgrptab and open the
- * file. We must reset the owner, group and perms to those
- * of the original dgrptab file.
- */
- (void) sprintf(buf, TDGTABNM, dirname, getpid());
- if (fp = fopen(buf, "w")) {
- *pname = buf;
- (void) fchmod(fileno(fp), sbuf.st_mode & 0777);
- (void) fchown(fileno(fp), sbuf.st_uid, sbuf.st_gid);
- } else {
- free(buf);
+ /* Get space for the temp dgrptab pathname */
+ if (asprintf(&buf, TDGTABNM, dirname, getpid()) >= 0) {
+ /*
+ * Build the name of the temp dgrptab and open
+ * the file. We must reset the owner, group
+ * and perms to those of the original dgrptab
+ * file.
+ */
+ if (fp = fopen(buf, "w")) {
+ *pname = buf;
+ (void) fchmod(fileno(fp), sbuf.st_mode & 0777);
+ (void) fchown(fileno(fp), sbuf.st_uid,
+ sbuf.st_gid);
+ } else {
+ free(buf);
+ }
}
- }
- /* Free the space containing the dgrptab's name */
- free(oldname);
+ /* Free the space containing the dgrptab's name */
+ free(oldname);
}
/* Finished. Return what we've got */
@@ -243,21 +244,26 @@ mknewdgrptab(char *tempname) /* Ptr to name of temp dgrp tab */
/* Get the dgrptab's pathname */
if (dgrpname = _dgrptabpath()) {
- /* Unlink the existing file */
- if (unlink(dgrpname) == 0) {
+ /* Unlink the existing file */
+ if (unlink(dgrpname) == 0) {
- /* Make the temp file the real device-group table */
- noerr = (link(tempname, dgrpname) == 0) ? TRUE : FALSE;
+ /* Make the temp file the real device-group table */
+ noerr = (link(tempname, dgrpname) == 0) ? TRUE : FALSE;
- /* Remove the temp file */
- if (noerr) noerr = rmnewdgrptab(tempname);
+ /* Remove the temp file */
+ if (noerr)
+ noerr = rmnewdgrptab(tempname);
- } else noerr = FALSE; /* unlink() failed */
+ } else {
+ noerr = FALSE; /* unlink() failed */
+ }
- /* Free the dgrptab's name */
- free(dgrpname);
+ /* Free the dgrptab's name */
+ free(dgrpname);
- } else noerr = FALSE; /* dgrptabpath() failed */
+ } else {
+ noerr = FALSE; /* dgrptabpath() failed */
+ }
/* Finished. Return success indicator */
return (noerr);
@@ -297,48 +303,54 @@ lkdgrptab(
noerr = TRUE;
if (_opendgrptab(o_mode)) {
- /*
- * Lock the device-group table (for writing). If it's not
- * available, wait until it is, then close and open the
- * table (modify and delete change the table!) and try
- * to lock it again
- */
+ /*
+ * Lock the device-group table (for writing). If it's not
+ * available, wait until it is, then close and open the
+ * table (modify and delete change the table!) and try
+ * to lock it again
+ */
- /* Build the locking structure */
- lockinfo.l_type = lktype;
- lockinfo.l_whence = 0;
- lockinfo.l_start = 0L;
- lockinfo.l_len = 0L;
- olderrno = errno;
+ /* Build the locking structure */
+ lockinfo.l_type = lktype;
+ lockinfo.l_whence = 0;
+ lockinfo.l_start = 0L;
+ lockinfo.l_len = 0L;
+ olderrno = errno;
- /* Keep on going until we lock the file or an error happens */
- while ((fcntl(fileno(oam_dgroup), F_SETLK, &lockinfo) == -1) &&
- !noerr) {
+ /* Keep on going until we lock the file or an error happens */
+ while ((fcntl(fileno(oam_dgroup), F_SETLK, &lockinfo) == -1) &&
+ !noerr) {
- /*
- * fcntl() failed.
- * If errno=EACCES, it's because the file's locked by someone
- * else. Wait for the file to be unlocked, then close and
- * reopen the file and try the lock again.
- */
+ /*
+ * fcntl() failed. If errno=EACCES, it's
+ * because the file's locked by someone else.
+ * Wait for the file to be unlocked, then
+ * close and reopen the file and try the lock
+ * again.
+ */
- if (errno == EACCES) {
- if (fcntl(fileno(oam_dgroup), F_SETLKW, &lockinfo) == -1)
- noerr = FALSE;
- else {
- _enddgrptab();
- if (!_opendgrptab(o_mode)) noerr = FALSE;
- else errno = olderrno;
- }
+ if (errno == EACCES) {
+ if (fcntl(fileno(oam_dgroup), F_SETLKW,
+ &lockinfo) == -1)
+ noerr = FALSE;
+ else {
+ _enddgrptab();
+ if (!_opendgrptab(o_mode))
+ noerr = FALSE;
+ else
+ errno = olderrno;
+ }
- } else noerr = FALSE; /* fcntl() failed hard */
+ } else
+ noerr = FALSE; /* fcntl() failed hard */
- } /* End while (fcntl() && !noerr) */
+ } /* End while (fcntl() && !noerr) */
- /* Don't keep file open if an error happened */
- if (!noerr) _enddgrptab();
+ /* Don't keep file open if an error happened */
+ if (!noerr) _enddgrptab();
- } else noerr = FALSE; /* _opendgrptab() failed */
+ } else
+ noerr = FALSE; /* _opendgrptab() failed */
/* Done */
return (noerr);
@@ -499,7 +511,8 @@ _putdgrptabrec(
/* Comment or data record? */
- if (rec->comment) count = fputs(rec->dataspace, stream);
+ if (rec->comment)
+ count = fputs(rec->dataspace, stream);
else {
/*
diff --git a/usr/src/lib/libinstzones/common/instzones_lib.h b/usr/src/lib/libinstzones/common/instzones_lib.h
index a7acdbcf47..c208c5c981 100644
--- a/usr/src/lib/libinstzones/common/instzones_lib.h
+++ b/usr/src/lib/libinstzones/common/instzones_lib.h
@@ -98,9 +98,6 @@ typedef struct _argArray_t argArray_t;
/* this locks all packages, in all zones */
#define LOBJ_PKGADMIN "zone.*/package.*"
-/* this locks all patches, in all zones */
-#define LOBJ_PATCHADMIN "zone.*/patch.*"
-
#define LOCK_OBJECT_MAXLEN 512
#define LOCK_KEY_MAXLEN 37
diff --git a/usr/src/lib/libinstzones/common/zones.c b/usr/src/lib/libinstzones/common/zones.c
index dc3a2036b2..9abb397381 100644
--- a/usr/src/lib/libinstzones/common/zones.c
+++ b/usr/src/lib/libinstzones/common/zones.c
@@ -693,20 +693,6 @@ z_lock_this_zone(ZLOCKS_T a_lflags)
}
}
- /* lock patch administration always */
-
- if (a_lflags & ZLOCKS_PATCH_ADMIN) {
- b = _z_lock_zone_object(&_z_global_data._z_ObjectLocks,
- zoneName, LOBJ_PATCHADMIN, pid,
- MSG_ZONES_LCK_THIS_PATCHADM,
- ERR_ZONES_LCK_THIS_PATCHADM);
- if (!b) {
- (void) z_unlock_this_zone(a_lflags);
- (void) free(zoneName);
- return (B_FALSE);
- }
- }
-
(void) free(zoneName);
return (B_TRUE);
@@ -908,9 +894,6 @@ z_mount_in_lz(char **r_lzMountPoint, char **r_lzRootPath, char *a_zoneName,
/*
* lofs resolve the non-global zone's root path first in case
* its in a path that's been lofs mounted read-only.
- * (e.g. This happens when we're tyring to patch a zone in an ABE
- * that lives on a filesystem that the ABE shares with the currently
- * running BE.)
*/
z_resolve_lofs(lzRootPath, sizeof (lzRootPath));
@@ -1390,16 +1373,6 @@ z_unlock_this_zone(ZLOCKS_T a_lflags)
zoneName = z_get_zonename();
- /* unlock patch administration */
-
- if (a_lflags & ZLOCKS_PATCH_ADMIN) {
- b = _z_unlock_zone_object(&_z_global_data._z_ObjectLocks,
- zoneName, LOBJ_PATCHADMIN, ERR_ZONES_ULK_THIS_PATCH);
- if (!b) {
- errors = B_TRUE;
- }
- }
-
/* unlock package administration */
if (a_lflags & ZLOCKS_PKG_ADMIN) {
@@ -1670,7 +1643,7 @@ z_is_zone_branded(char *zoneName)
/*
* Both "native" and "cluster" are native brands
* that use the standard facilities in the areas
- * of packaging/installation/patching/update.
+ * of packaging/installation/update.
*/
if (streq(brandname, NATIVE_BRAND_NAME) ||
streq(brandname, CLUSTER_BRAND_NAME)) {
diff --git a/usr/src/lib/libinstzones/common/zones_locks.c b/usr/src/lib/libinstzones/common/zones_locks.c
index 36db482657..6352e496bc 100644
--- a/usr/src/lib/libinstzones/common/zones_locks.c
+++ b/usr/src/lib/libinstzones/common/zones_locks.c
@@ -540,31 +540,6 @@ _z_lock_zone(zoneListElement_t *a_zlst, ZLOCKS_T a_lflags)
}
/*
- * acquire patch lock
- */
-
- if (a_lflags & ZLOCKS_PATCH_ADMIN) {
-
- /*
- * zone and package administration is locked; lock patch
- * administration; if the lock cannot be released, stop,
- * release the other locks and return an error
- */
-
- _z_echoDebug(DBG_ZONES_LCK_ZONE_PATCHADM, a_zlst->_zlName,
- LOBJ_PATCHADMIN);
-
- b = _z_lock_zone_object(&a_zlst->_zlLockObjects,
- scratchName, LOBJ_PATCHADMIN, (pid_t)0,
- MSG_ZONES_LCK_ZONE_PATCHADM,
- ERR_ZONES_LCK_ZONE_PATCHADM);
- if (b == B_FALSE) {
- (void) _z_unlock_zone(a_zlst, a_lflags);
- return (b);
- }
- }
-
- /*
* all locks have been obtained - return success!
*/
@@ -832,23 +807,6 @@ _z_unlock_zone(zoneListElement_t *a_zlst, ZLOCKS_T a_lflags)
scratchName = a_zlst->_zlScratchName == NULL ? a_zlst->_zlName :
a_zlst->_zlScratchName;
- if (a_lflags & ZLOCKS_PATCH_ADMIN) {
- /*
- * if locked, unlock patch administration lock
- * if the lock cannot be released, continue anyway
- */
-
- _z_echoDebug(DBG_ZONES_ULK_ZONE_PATCHADM, a_zlst->_zlName,
- LOBJ_PATCHADMIN);
-
- b = _z_unlock_zone_object(&a_zlst->_zlLockObjects,
- scratchName, LOBJ_PATCHADMIN,
- WRN_ZONES_ULK_ZONE_PATCHADM);
- if (b == B_FALSE) {
- errors = B_TRUE;
- }
- }
-
if (a_lflags & ZLOCKS_PKG_ADMIN) {
/*
* if locked, unlock package administration lock
diff --git a/usr/src/lib/libinstzones/common/zones_strings.h b/usr/src/lib/libinstzones/common/zones_strings.h
index 61d928d75b..13fd978c41 100644
--- a/usr/src/lib/libinstzones/common/zones_strings.h
+++ b/usr/src/lib/libinstzones/common/zones_strings.h
@@ -93,7 +93,6 @@ extern "C" {
#define DBG_ZONES_LCK_ZONES_EXIST ILIBSTR("locking all non-global zones defined")
#define DBG_ZONES_LCK_ZONES_NOZONES ILIBSTR("no zones locked: no non-global zones exist")
#define DBG_ZONES_LCK_ZONES_UNIMP ILIBSTR("no zones locked: zones are not implemented")
-#define DBG_ZONES_LCK_ZONE_PATCHADM ILIBSTR("locking patch administration: zone <%s> object <%s>")
#define DBG_ZONES_LCK_ZONE_PKGADM ILIBSTR("locking package administration: zone <%s> object <%s>")
#define DBG_ZONES_LCK_ZONE_ZONEADM ILIBSTR("locking zone administration: zone <%s> object <%s>")
#define DBG_ZONES_MOUNT_IN_LZ_ENTRY ILIBSTR("mount in non-global zone: zone <%s> global-zone path <%s>")
@@ -112,7 +111,6 @@ extern "C" {
#define DBG_ZONES_ULK_ZONES_EXIST ILIBSTR("unlocking all non-global zones defined")
#define DBG_ZONES_ULK_ZONES_NOZONES ILIBSTR("no zones unlocked: no non-global zones exist")
#define DBG_ZONES_ULK_ZONES_UNIMP ILIBSTR("no zones unlocked: zones are not implemented")
-#define DBG_ZONES_ULK_ZONE_PATCHADM ILIBSTR("unlocking patch administration: zone <%s> object <%s>")
#define DBG_ZONES_ULK_ZONE_PKGADM ILIBSTR("unlocking package administration: zone <%s> object <%s>")
#define DBG_ZONES_ULK_ZONE_ZONEADM ILIBSTR("unlocking zone administration: zone <%s> object <%s>")
#define DBG_ZONES_UNMOUNT_FROM_LZ_ENTRY ILIBSTR("unmount non-global zone: mount point <%s>")
@@ -171,16 +169,13 @@ extern "C" {
#define ERR_ZONEREADY_DIDNT_READY ILIBSTR("unable to ready zone <%s>: zone failed to transition to ready state")
#define ERR_ZONEREADY_EXEC ILIBSTR("unable to ready zone: could not execute zone administration command <%s>: %s")
#define ERR_ZONEROOT_NOTDIR ILIBSTR("unable to use temporary mount point <%s> in zone <%s>: %s")
-#define ERR_ZONES_LCK_THIS_PATCHADM ILIBSTR("Unable to acquire patch administration lock for this system; try again later")
#define ERR_ZONES_LCK_THIS_PKGADM ILIBSTR("Unable to acquire package administration lock for this system; try again later")
#define ERR_ZONES_LCK_THIS_ZONEADM ILIBSTR("Unable to acquire zone administration lock for this system; please try again later")
#define ERR_ZONES_LCK_ZONES_FAILED ILIBSTR("Unable to acquire lock on non-global zone <%s>: releasing all locks")
-#define ERR_ZONES_LCK_ZONE_PATCHADM ILIBSTR("Unable to acquire patch administration lock for zone <%s>; please try again later")
#define ERR_ZONES_LCK_ZONE_PKGADM ILIBSTR("Unable to acquire package administration lock for zone <%s>; please try again later")
#define ERR_ZONES_LCK_ZONE_ZONEADM ILIBSTR("Unable to acquire zone administration lock for zone <%s>; please try again later")
#define ERR_ZONES_NOT_IMPLEMENTED ILIBSTR("error: zones not implemented")
#define ERR_ZONES_ULK_THIS_PACKAGE ILIBSTR("Unable to release package administration lock for this system; try again later")
-#define ERR_ZONES_ULK_THIS_PATCH ILIBSTR("Unable to release patch administration lock for this system; try again later")
#define ERR_ZONES_ULK_THIS_ZONES ILIBSTR("Unable to release zone administration lock for this system; please try again later")
#define ERR_ZONE_LIST_EMPTY ILIBSTR("empty zone list specified")
#define ERR_ZONE_NAME_ILLEGAL ILIBSTR("illegal zone name %.*s")
@@ -197,10 +192,8 @@ extern "C" {
*/
#define MSG_PROG_ERR ILIBSTR("ERROR: %s")
-#define MSG_ZONES_LCK_THIS_PATCHADM ILIBSTR("## Waiting for up to <%ld> seconds for patch administration commands to become available (another user is administering patches)")
#define MSG_ZONES_LCK_THIS_PKGADM ILIBSTR("## Waiting for up to <%ld> seconds for package administration commands to become available (another user is administering packages)")
#define MSG_ZONES_LCK_THIS_ZONEADM ILIBSTR("## Waiting for up to <%ld> seconds for zone administration commands to become available (another user is administering zones)")
-#define MSG_ZONES_LCK_ZONE_PATCHADM ILIBSTR("## Waiting for up to <%ld> seconds for patch administration commands to become available (another user is administering patches on zone <%s>)")
#define MSG_ZONES_LCK_ZONE_PKGADM ILIBSTR("## Waiting for up to <%ld> seconds for package administration commands to become available (another user is administering packages on zone <%s>)")
#define MSG_ZONES_LCK_ZONE_ZONEADM ILIBSTR("## Waiting for up to <%ld> seconds for zone administration commands to become available (another user is administering zones on zone <%s>)")
@@ -209,7 +202,6 @@ extern "C" {
* during the normal usage of the products
*/
-#define WRN_ZONES_ULK_ZONE_PATCHADM ILIBSTR("WARNING: Unable to release patch administration lock for zone <%s>")
#define WRN_ZONES_ULK_ZONE_PKGADM ILIBSTR("WARNING: Unable to release package administration lock for zone <%s>")
#define WRN_ZONES_ULK_ZONE_ZONEADM ILIBSTR("WARNING: Unable to release zone administration lock for zone <%s>")
diff --git a/usr/src/lib/libinstzones/hdrs/instzones_api.h b/usr/src/lib/libinstzones/hdrs/instzones_api.h
index 7ff3a649e4..b145b0dc5f 100644
--- a/usr/src/lib/libinstzones/hdrs/instzones_api.h
+++ b/usr/src/lib/libinstzones/hdrs/instzones_api.h
@@ -80,7 +80,6 @@ typedef unsigned long ZLOCKS_T;
#define ZLOCKS_ZONE_ADMIN ((ZLOCKS_T)0x00000001) /* zone admin */
#define ZLOCKS_PKG_ADMIN ((ZLOCKS_T)0x00000002) /* package admin */
-#define ZLOCKS_PATCH_ADMIN ((ZLOCKS_T)0x00000004) /* patch admin */
#define ZLOCKS_ALL ((ZLOCKS_T)0xFFFFFFFF) /* all locks */
#define ZLOCKS_NONE ((ZLOCKS_T)0x00000000) /* no locks */
diff --git a/usr/src/lib/libpkg/Makefile.com b/usr/src/lib/libpkg/Makefile.com
index d2f77fff33..054752764f 100644
--- a/usr/src/lib/libpkg/Makefile.com
+++ b/usr/src/lib/libpkg/Makefile.com
@@ -34,7 +34,7 @@ OBJECTS= \
gpkgmap.o isdir.o logerr.o \
mappath.o ncgrpw.o nhash.o \
pkgexecl.o pkgexecv.o pkgmount.o \
- pkgtrans.o pkgxpand.o ppkgmap.o \
+ pkgtrans.o ppkgmap.o \
progerr.o putcfile.o rrmdir.o \
runcmd.o srchcfile.o tputcfent.o \
verify.o security.o pkgweb.o \
diff --git a/usr/src/lib/libpkg/common/ckparam.c b/usr/src/lib/libpkg/common/ckparam.c
index 68284e6012..47beb1c6be 100644
--- a/usr/src/lib/libpkg/common/ckparam.c
+++ b/usr/src/lib/libpkg/common/ckparam.c
@@ -162,7 +162,7 @@ static int
too_long(char *param, char *pt, int len)
{
if (strlen(pt) > (size_t)len) {
- progerr(pkg_gt(ERR_LEN), pt);
+ progerr(pkg_gt(ERR_LEN), param);
return (1);
}
return (0);
diff --git a/usr/src/lib/libpkg/common/dstream.c b/usr/src/lib/libpkg/common/dstream.c
index 68ff540393..38ca430614 100644
--- a/usr/src/lib/libpkg/common/dstream.c
+++ b/usr/src/lib/libpkg/common/dstream.c
@@ -42,18 +42,10 @@
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <fcntl.h>
-#ifdef u3b2
-#include <sys/sys3b.h>
-#endif /* u3b2 */
#include <openssl/err.h>
#include "pkglib.h"
#include "pkglibmsgs.h"
#include "pkglocale.h"
-#ifdef u3b2
-static
-struct stat orig_st_buf; /* Stat structure of original file (3B2/CTC) */
-static char ds_ctcflg;
-#endif /* u3b2 */
/* libadm.a */
extern char *devattr(char *device, char *attribute);
@@ -203,7 +195,7 @@ ds_readbuf(char *device)
(void) ds_close(0);
return (0);
}
- memcpy(ds_header, buf, BLK_SIZE);
+ (void) memcpy(ds_header, buf, BLK_SIZE);
ds_headsize = BLK_SIZE;
if (ds_ginit(device) < 0) {
@@ -232,7 +224,7 @@ ds_volsum(struct dstoc *toc)
char volnos[128], tmpvol[128];
if (toc->volnos[0]) {
int index, sum;
- sscanf(toc->volnos, "%d %[ 0-9]", &curpartcnt, volnos);
+ (void) sscanf(toc->volnos, "%d %[ 0-9]", &curpartcnt, volnos);
volcnt = 0;
sum = curpartcnt;
while (sum < toc->nparts && sscanf(volnos, "%d %[ 0-9]",
@@ -254,7 +246,8 @@ static void
ds_pkginit(void)
{
if (ds_toc->volnos[0])
- sscanf(ds_toc->volnos, "%d %[ 0-9]", &ds_curpartcnt, ds_volnos);
+ (void) sscanf(ds_toc->volnos, "%d %[ 0-9]", &ds_curpartcnt,
+ ds_volnos);
else
ds_curpartcnt = -1;
}
@@ -263,9 +256,9 @@ ds_pkginit(void)
* functions to pass current package info to exec'ed program
*/
void
-ds_putinfo(char *buf)
+ds_putinfo(char *buf, size_t sz)
{
- (void) sprintf(buf, "%d %d %d %d %d %d %d %d %d %d %s",
+ (void) snprintf(buf, sz, "%d %d %d %d %d %d %d %d %d %d %s",
ds_fd, ds_realfd, ds_volcnt, ds_volno, ds_totread, ds_volpart,
ds_skippart, ds_bufsize, ds_toc->nparts, ds_toc->maxsiz,
ds_toc->volnos);
@@ -435,7 +428,7 @@ ds_init(char *device, char **pkg, char *norewind)
(void) ds_close(0);
return (1);
}
- memcpy(ds_header_raw, ds_header, header_size);
+ (void) memcpy(ds_header_raw, ds_header, header_size);
/* read datastream table of contents */
ds_head = tail = (struct dstoc *)0;
@@ -454,6 +447,7 @@ ds_init(char *device, char **pkg, char *norewind)
(void) free(ds_header);
return (-1);
}
+ /* LINTED E_SEC_SCANF_UNBOUNDED_COPY */
if (sscanf(line, "%s %d %d %[ 0-9]", toc_pt->pkg,
&toc_pt->nparts, &toc_pt->maxsiz, toc_pt->volnos) < 3) {
progerr(pkg_gt(ERR_UNPACK));
@@ -476,8 +470,8 @@ ds_init(char *device, char **pkg, char *norewind)
(void) free(ds_header);
return (-1);
}
- sighold(SIGINT);
- sigrelse(SIGINT);
+ (void) sighold(SIGINT);
+ (void) sigrelse(SIGINT);
if (!ds_head) {
progerr(pkg_gt(ERR_UNPACK));
logerr(pkg_gt(MSG_EMPTY));
@@ -485,25 +479,22 @@ ds_init(char *device, char **pkg, char *norewind)
return (-1);
}
/* this could break, thanks to cpio command limit */
-#ifndef SUNOS41
- (void) sprintf(cmd, "%s -icdumD -C %d", CPIOPROC, (int)BLK_SIZE);
-#else
- (void) sprintf(cmd, "%s -icdum -C %d", CPIOPROC, (int)BLK_SIZE);
-#endif
+ (void) snprintf(cmd, sizeof (cmd), "%s -icdumD -C %d",
+ CPIOPROC, (int)BLK_SIZE);
n = 0;
for (i = 0; pkg[i]; i++) {
if (strcmp(pkg[i], "all") == 0)
continue;
if (n == 0) {
- strcat(cmd, " ");
+ (void) strlcat(cmd, " ", CMDSIZ);
n = 1;
}
- strlcat(cmd, pkg[i], CMDSIZ);
- strlcat(cmd, "'/*' ", CMDSIZ);
+ (void) strlcat(cmd, pkg[i], CMDSIZ);
+ (void) strlcat(cmd, "'/*' ", CMDSIZ);
/* extract signature too, if present. */
- strlcat(cmd, SIGNATURE_FILENAME, CMDSIZ);
- strlcat(cmd, " ", CMDSIZ);
+ (void) strlcat(cmd, SIGNATURE_FILENAME, CMDSIZ);
+ (void) strlcat(cmd, " ", CMDSIZ);
}
/*
@@ -608,13 +599,9 @@ ds_getpkg(char *device, int n, char *dstdir)
logerr(pkg_gt(MSG_STATFS), errno);
return (-1);
}
-#ifdef SUNOS41
- free_blocks = svfsb.f_bfree * howmany(svfsb.f_bsize, DEV_BSIZE);
-#else /* !SUNOS41 */
free_blocks = (((long)svfsb.f_frsize > 0) ?
- howmany(svfsb.f_frsize, DEV_BSIZE) :
- howmany(svfsb.f_bsize, DEV_BSIZE)) * svfsb.f_bfree;
-#endif /* SUNOS41 */
+ howmany(svfsb.f_frsize, DEV_BSIZE) :
+ howmany(svfsb.f_bsize, DEV_BSIZE)) * svfsb.f_bfree;
if ((ds_maxsiz + 50) > free_blocks) {
progerr(pkg_gt(ERR_UNPACK));
logerr(pkg_gt(MSG_NOSPACE), ds_maxsiz+50, free_blocks);
@@ -659,12 +646,8 @@ ds_skip(char *device, int nskip)
while (nskip--) {
/* skip this one */
-#ifndef SUNOS41
- (void) sprintf(cmd, "%s -ictD -C %d > /dev/null",
-#else
- (void) sprintf(cmd, "%s -ict -C %d > /dev/null",
-#endif
- CPIOPROC, (int)BLK_SIZE);
+ (void) snprintf(cmd, sizeof (cmd),
+ "%s -ictD -C %d > /dev/null", CPIOPROC, (int)BLK_SIZE);
if (n = esystem(cmd, ds_fd, -1)) {
rpterr();
progerr(pkg_gt(ERR_UNPACK));
@@ -706,11 +689,7 @@ ds_next(char *device, char *instdir)
(void) strcpy(ds_volnos, tmpvol);
ds_curpartcnt += index;
}
-#ifndef SUNOS41
- (void) sprintf(cmd, "%s -icdumD -C %d",
-#else
- (void) sprintf(cmd, "%s -icdum -C %d",
-#endif
+ (void) snprintf(cmd, sizeof (cmd), "%s -icdumD -C %d",
CPIOPROC, (int)BLK_SIZE);
if (n = esystem(cmd, ds_fd, -1)) {
rpterr();
@@ -794,7 +773,7 @@ BIO_ds_dump_header(PKG_ERR *err, BIO *bio)
char zeros[BLK_SIZE];
- memset(zeros, 0, BLK_SIZE);
+ (void) memset(zeros, 0, BLK_SIZE);
if (BIO_write(bio, ds_header_raw, ds_headsize) != ds_headsize) {
pkgerr_add(err, PKGERR_WRITE, ERR_WRITE, "bio",
@@ -807,32 +786,12 @@ BIO_ds_dump_header(PKG_ERR *err, BIO *bio)
/*
* ds_ginit: Determine the device being accessed, set the buffer size,
- * and perform any device specific initialization. For the 3B2,
- * a device with major number of 17 (0x11) is an internal hard disk,
- * unless the minor number is 128 (0x80) in which case it is an internal
- * floppy disk. Otherwise, get the system configuration
- * table and check it by comparing slot numbers to major numbers.
- * For the special case of the 3B2 CTC several unusual things must be done.
- * To enable
- * streaming mode on the CTC, the file descriptor must be closed, re-opened
- * (with O_RDWR and O_CTSPECIAL flags set), the STREAMON ioctl(2) command
- * issued, and the file descriptor re-re-opened either read-only or write_only.
+ * and perform any device specific initialization.
*/
int
ds_ginit(char *device)
{
-#ifdef u3b2
- major_t maj;
- minor_t min;
- int nflag, i, count, size;
- struct s3bconf *buffer;
- struct s3bc *table;
- struct stat st_buf;
- int devtype;
- char buf[BLK_SIZE];
- int fd2, fd;
-#endif /* u3b2 */
int oflag;
char *pbufsize, cmd[CMDSIZ];
int fd2, fd;
@@ -843,104 +802,7 @@ ds_ginit(char *device)
} else
ds_bufsize = BLK_SIZE;
oflag = fcntl(ds_fd, F_GETFL, 0);
-#ifdef u3b2
- devtype = G_NO_DEV;
- if (fstat(ds_fd, &st_buf) == -1)
- return (-1);
- if (!S_ISCHR(st_buf.st_mode) && !S_ISBLK(st_buf.st_mode))
- goto lab;
-
- /*
- * We'll have to add a remote attribute to stat but this should
- * work for now.
- */
- else if (st_buf.st_dev & 0x8000) /* if remote rdev */
- goto lab;
-
- maj = major(st_buf.st_rdev);
- min = minor(st_buf.st_rdev);
- if (maj == 0x11) { /* internal hard or floppy disk */
- if (min & 0x80)
- devtype = G_3B2_FD; /* internal floppy disk */
- else
- devtype = G_3B2_HD; /* internal hard disk */
- } else {
- if (sys3b(S3BCONF, (struct s3bconf *)&count, sizeof (count)) ==
- -1)
- return (-1);
- size = sizeof (int) + (count * sizeof (struct s3bconf));
- buffer = (struct s3bconf *)malloc((unsigned)size);
- if (sys3b(S3BCONF, buffer, size) == -1)
- return (-1);
- table = (struct s3bc *)((char *)buffer + sizeof (int));
- for (i = 0; i < count; i++) {
- if (maj == (int)table->board) {
- if (strncmp(table->name, "CTC", 3) == 0) {
- devtype = G_3B2_CTC;
- break;
- } else if (strncmp(table->name, "TAPE", 4)
- == 0) {
- devtype = G_TAPE;
- break;
- }
- /* other possible devices can go here */
- }
- table++;
- }
- }
- switch (devtype) {
- case G_3B2_CTC: /* do special CTC initialization */
- ds_bufsize = pbufsize ? ds_bufsize : 15872;
- if (fstat(ds_fd, &orig_st_buf) < 0) {
- ds_bufsize = -1;
- break;
- }
- nflag = (O_RDWR | O_CTSPECIAL);
- (void) close(ds_fd);
- if ((ds_fd = open(device, nflag, 0666)) != -1) {
- if (ioctl(ds_fd, STREAMON) != -1) {
- (void) close(ds_fd);
- nflag = (oflag == O_WRONLY) ?
- O_WRONLY : O_RDONLY;
- if ((ds_fd =
- open(device, nflag, 0666)) == -1) {
- rpterr();
- progerr(
- pkg_gt(ERR_TRANSFER));
- logerr(pkg_gt(MSG_OPEN),
- device, errno);
- return (-1);
- }
- ds_bufsize = 15872;
- }
- } else
- ds_bufsize = -1;
- if (oflag == O_RDONLY && ds_header && ds_totread == 0)
- /* Have already read in first block of header */
- read(ds_fd, buf, BLK_SIZE);
- ds_ctcflg = 1;
- break;
- case G_NO_DEV:
- case G_3B2_HD:
- case G_3B2_FD:
- case G_TAPE:
- case G_SCSI_HD: /* not developed yet */
- case G_SCSI_FD:
- case G_SCSI_9T:
- case G_SCSI_Q24:
- case G_SCSI_Q120:
- case G_386_HD:
- case G_386_FD:
- case G_386_Q24:
- ds_bufsize = pbufsize ? ds_bufsize : BLK_SIZE;
- break;
- default:
- ds_bufsize = -1;
- errno = ENODEV;
- } /* devtype */
-lab:
-#endif /* u3b2 */
if (ds_bufsize > BLK_SIZE) {
if (oflag & O_WRONLY)
fd = 1;
@@ -948,20 +810,20 @@ lab:
fd = 0;
fd2 = fcntl(fd, F_DUPFD, fd);
(void) close(fd);
- fcntl(ds_fd, F_DUPFD, fd);
+ (void) fcntl(ds_fd, F_DUPFD, fd);
if (fd)
- sprintf(cmd, "%s obs=%d 2>/dev/null", DDPROC,
- ds_bufsize);
+ (void) snprintf(cmd, sizeof (cmd),
+ "%s obs=%d 2>/dev/null", DDPROC, ds_bufsize);
else
- sprintf(cmd, "%s ibs=%d 2>/dev/null", DDPROC,
- ds_bufsize);
+ (void) snprintf(cmd, sizeof (cmd),
+ "%s ibs=%d 2>/dev/null", DDPROC, ds_bufsize);
if ((ds_pp = popen(cmd, fd ? "w" : "r")) == NULL) {
progerr(pkg_gt(ERR_TRANSFER));
logerr(pkg_gt(MSG_POPEN), cmd, errno);
return (-1);
}
(void) close(fd);
- fcntl(fd2, F_DUPFD, fd);
+ (void) fcntl(fd2, F_DUPFD, fd);
(void) close(fd2);
ds_realfd = ds_fd;
ds_fd = fileno(ds_pp);
@@ -972,42 +834,8 @@ lab:
int
ds_close(int pkgendflg)
{
-#ifdef u3b2
- int cnt, mode;
- char *ptr;
- struct stat statbuf;
-#endif /* u3b2 */
int n, ret = 0;
-#ifdef u3b2
- if (ds_pp && ds_ctcflg) {
- ds_ctcflg = 0;
- if ((mode = fcntl(ds_realfd, F_GETFL, 0)) < 0) {
- ret = -1;
- } else if (mode & O_WRONLY) {
- /*
- * pipe to dd write process,
- * make sure one more buffer
- * gets written out
- */
- if ((ptr = calloc(BLK_SIZE, 1)) == NULL) {
- ret = -1;
- /* pad to bufsize */
- } else {
- cnt = ds_bufsize;
- while (cnt > 0) {
- if ((n = write(ds_fd, ptr,
- BLK_SIZE)) < 0) {
- ret = -1;
- break;
- }
- cnt -= n;
- }
- (void) free(ptr);
- }
- }
- }
-#endif
if (pkgendflg) {
if (ds_header)
(void) free(ds_header);
diff --git a/usr/src/lib/libpkg/common/gpkglist.c b/usr/src/lib/libpkg/common/gpkglist.c
index 9257c6afcb..34708b8fe6 100644
--- a/usr/src/lib/libpkg/common/gpkglist.c
+++ b/usr/src/lib/libpkg/common/gpkglist.c
@@ -146,8 +146,9 @@ gpkglist(char *dir, char **pkg, char **catg)
if (!info.pkginst || !info.name || !info.arch ||
!info.version)
continue;
- (void) sprintf(temp, "%s %s\n(%s) %s", info.pkginst,
- info.name, info.arch, info.version);
+ (void) snprintf(temp, sizeof (temp),
+ "%s %s\n(%s) %s", info.pkginst,
+ info.name, info.arch, info.version);
if (setitem(menup, temp)) {
errno = EFAULT;
return (NULL);
diff --git a/usr/src/lib/libpkg/common/gpkgmap.c b/usr/src/lib/libpkg/common/gpkgmap.c
index d94b16c4d1..4bbe60dfc3 100644
--- a/usr/src/lib/libpkg/common/gpkgmap.c
+++ b/usr/src/lib/libpkg/common/gpkgmap.c
@@ -147,13 +147,8 @@ gpkgmap(struct cfent *ept, FILE *fp)
ept->ainfo.mode = d_mode;
(void) strcpy(ept->ainfo.owner, d_owner);
(void) strcpy(ept->ainfo.group, d_group);
-#ifdef SUNOS41
- ept->ainfo.xmajor = BADMAJOR;
- ept->ainfo.xminor = BADMINOR;
-#else
ept->ainfo.major = BADMAJOR;
ept->ainfo.minor = BADMINOR;
-#endif
ept->cinfo.cksum = ept->cinfo.modtime = ept->cinfo.size = (-1L);
ept->npkgs = 0;
@@ -310,18 +305,10 @@ error:
}
if (strchr("cb", ept->ftype)) {
-#ifdef SUNOS41
- ept->ainfo.xmajor = BADMAJOR;
- ept->ainfo.xminor = BADMINOR;
- if (getnum(fp, 10, (long *)&ept->ainfo.xmajor, BADMAJOR) ||
- getnum(fp, 10, (long *)&ept->ainfo.xminor, BADMINOR))
-#else
ept->ainfo.major = BADMAJOR;
ept->ainfo.minor = BADMINOR;
if (getnum(fp, 10, (long *)&ept->ainfo.major, BADMAJOR) ||
- getnum(fp, 10, (long *)&ept->ainfo.minor, BADMINOR))
-#endif
- {
+ getnum(fp, 10, (long *)&ept->ainfo.minor, BADMINOR)) {
setErrstr(pkg_gt(ERR_CANNOT_READ_MM_DEVNUMS));
goto error;
}
diff --git a/usr/src/lib/libpkg/common/keystore.c b/usr/src/lib/libpkg/common/keystore.c
index ad94b96c2d..633c04b58e 100644
--- a/usr/src/lib/libpkg/common/keystore.c
+++ b/usr/src/lib/libpkg/common/keystore.c
@@ -994,7 +994,7 @@ check_cert(PKG_ERR *err, X509 *cert)
{
char currtimestr[ATTR_MAX];
time_t currtime;
- char *r, *before_str, *after_str;
+ char *r;
/* get current time */
if ((currtime = time(NULL)) == (time_t)-1) {
pkgerr_add(err, PKGERR_TIME, gettext(ERR_CURR_TIME));
@@ -1942,7 +1942,7 @@ write_keystore(PKG_ERR *err, keystore_t *keystore,
* use the one used when the keystore
* was read
*/
- strlcpy(passbuf, keystore->passphrase,
+ (void) strlcpy(passbuf, keystore->passphrase,
KEYSTORE_PASS_MAX);
}
@@ -1984,7 +1984,7 @@ write_keystore(PKG_ERR *err, keystore_t *keystore,
}
} else {
/* use the one used when the keystore was read */
- strlcpy(passbuf, keystore->passphrase,
+ (void) strlcpy(passbuf, keystore->passphrase,
KEYSTORE_PASS_MAX);
}
diff --git a/usr/src/lib/libpkg/common/logerr.c b/usr/src/lib/libpkg/common/logerr.c
index 7d304b059e..2c648f2fdd 100644
--- a/usr/src/lib/libpkg/common/logerr.c
+++ b/usr/src/lib/libpkg/common/logerr.c
@@ -34,7 +34,7 @@
#include <stdarg.h>
#include "pkglocale.h"
-/*VARARGS*/
+/*PRINTFLIKE1*/
void
logerr(char *fmt, ...)
{
@@ -59,7 +59,7 @@ logerr(char *fmt, ...)
* this routine be in the same internationalization domain
* as this library.
*/
- (void) vsprintf(buffer, fmt, ap);
+ (void) vsnprintf(buffer, sizeof (buffer), fmt, ap);
va_end(ap);
diff --git a/usr/src/lib/libpkg/common/mapfile-vers b/usr/src/lib/libpkg/common/mapfile-vers
index ce2bad1bbe..ffdda251f7 100644
--- a/usr/src/lib/libpkg/common/mapfile-vers
+++ b/usr/src/lib/libpkg/common/mapfile-vers
@@ -132,14 +132,12 @@ SYMBOL_VERSION SUNWprivate {
open_keystore;
path_valid;
pkg_passphrase_cb;
- pkgalias;
pkgclosefilter;
pkgcloseserver;
pkgcmd;
pkgerr;
pkgerr_add;
pkgerr_clear;
- pkgerr_dump;
pkgerr_free;
pkgerr_get;
pkgerr_new;
diff --git a/usr/src/lib/libpkg/common/ncgrpw.c b/usr/src/lib/libpkg/common/ncgrpw.c
index cf3151164e..52eb9f813b 100644
--- a/usr/src/lib/libpkg/common/ncgrpw.c
+++ b/usr/src/lib/libpkg/common/ncgrpw.c
@@ -595,15 +595,16 @@ clgrnam(char *nam)
struct group *gr;
char *instroot, *buf;
FILE *gr_ptr;
+ size_t bufsz;
if ((instroot = get_install_root()) != NULL) {
- if ((buf = (char *)malloc(strlen(instroot) +
- strlen(GROUP) + 1)) == NULL) {
+ bufsz = strlen(instroot) + strlen(GROUP) + 1;
+ if ((buf = (char *)malloc(bufsz)) == NULL) {
(void) fprintf(stderr,
- pkg_gt(ERR_MALLOC), "clgrnam()",
- strlen(instroot) + strlen(GROUP), "buf");
+ pkg_gt(ERR_MALLOC), "clgrnam()",
+ strlen(instroot) + strlen(GROUP), "buf");
}
- (void) sprintf(buf, "%s%s", instroot, GROUP);
+ (void) snprintf(buf, bufsz, "%s%s", instroot, GROUP);
if ((gr_ptr = fopen(buf, "r")) == NULL) {
free(buf);
return (NULL);
@@ -636,13 +637,12 @@ clpwnam(char *nam)
FILE *pw_ptr;
if ((instroot = get_install_root()) != NULL) {
- if ((buf = (char *)malloc(strlen(instroot) +
- strlen(PASSWD) + 1)) == NULL) {
+ if (asprintf(&buf, "%s%s", instroot, PASSWD) < 0) {
(void) fprintf(stderr,
- pkg_gt(ERR_MALLOC), "clpwnam()",
- strlen(instroot) + strlen(PASSWD), "buf");
+ pkg_gt(ERR_MALLOC), "clpwnam()",
+ strlen(instroot) + strlen(PASSWD), "buf");
+ return (NULL);
}
- (void) sprintf(buf, "%s%s", instroot, PASSWD);
if ((pw_ptr = fopen(buf, "r")) == NULL) {
free(buf);
return (NULL);
@@ -675,13 +675,13 @@ clgrgid(gid_t gid)
FILE *gr_ptr;
if ((instroot = get_install_root()) != NULL) {
- if ((buf = (char *)malloc(strlen(instroot) +
- strlen(GROUP) + 1)) == NULL) {
+ if (asprintf(&buf, "%s%s", instroot, GROUP) < 0) {
(void) fprintf(stderr,
- pkg_gt(ERR_MALLOC), "clgrgid()",
- strlen(instroot) + strlen(GROUP), "buf");
+ pkg_gt(ERR_MALLOC), "clgrgid()",
+ strlen(instroot) + strlen(GROUP), "buf");
+ return (NULL);
}
- (void) sprintf(buf, "%s%s", instroot, GROUP);
+
if ((gr_ptr = fopen(buf, "r")) == NULL) {
free(buf);
return (NULL);
@@ -714,13 +714,11 @@ clpwuid(uid_t uid)
FILE *pw_ptr;
if ((instroot = get_install_root()) != NULL) {
- if ((buf = (char *)malloc(strlen(instroot) +
- strlen(PASSWD) + 1)) == NULL) {
- (void) fprintf(stderr,
- pkg_gt(ERR_MALLOC), "clpwuid()",
- strlen(instroot) + strlen(PASSWD), "buf");
+ if (asprintf(&buf, "%s%s", instroot, PASSWD) < 0) {
+ (void) fprintf(stderr, pkg_gt(ERR_MALLOC), "clpwuid()",
+ strlen(instroot) + strlen(PASSWD), "buf");
+ return (NULL);
}
- (void) sprintf(buf, "%s%s", instroot, PASSWD);
if ((pw_ptr = fopen(buf, "r")) == NULL) {
free(buf);
return (NULL);
diff --git a/usr/src/lib/libpkg/common/pkgerr.c b/usr/src/lib/libpkg/common/pkgerr.c
index eb0254055a..6828d88968 100644
--- a/usr/src/lib/libpkg/common/pkgerr.c
+++ b/usr/src/lib/libpkg/common/pkgerr.c
@@ -64,6 +64,7 @@ PKG_ERR
return (newerr);
}
+/*PRINTFLIKE3*/
void
pkgerr_add(PKG_ERR *err, PKG_ERR_CODE code, char *fmt, ...)
{
@@ -101,17 +102,6 @@ pkgerr_clear(PKG_ERR *err)
}
int
-pkgerr_dump(PKG_ERR *err, FILE *fp)
-{
- int i;
-
- for (i = 0; i < err->nerrs; i++) {
- (void) fprintf(fp, err->msgs[i]);
- }
- return (0);
-}
-
-int
pkgerr_num(PKG_ERR *err)
{
return (err->nerrs);
diff --git a/usr/src/lib/libpkg/common/pkgexecv.c b/usr/src/lib/libpkg/common/pkgexecv.c
index 28a7a07250..da703892db 100644
--- a/usr/src/lib/libpkg/common/pkgexecv.c
+++ b/usr/src/lib/libpkg/common/pkgexecv.c
@@ -40,6 +40,7 @@
#include <fcntl.h>
#include <pwd.h>
#include <grp.h>
+#include <note.h>
#include "pkglib.h"
#include "pkglibmsgs.h"
#include "pkglocale.h"
@@ -70,6 +71,7 @@ static int sig_received = 0;
static void
sig_trap(int a_signo)
{
+ _NOTE(ARGUNUSED(a_signo));
sig_received++;
}
@@ -252,7 +254,7 @@ pkgexecv(char *filein, char *fileout, char *uname, char *gname, char *arg[])
for (;;) {
status = 0;
- waitstat = waitpid(pid, (int *)&status, 0);
+ waitstat = waitpid(pid, &status, 0);
if (waitstat < 0) {
/* waitpid returned error */
if (errno == EAGAIN) {
@@ -293,8 +295,8 @@ pkgexecv(char *filein, char *fileout, char *uname, char *gname, char *arg[])
/* error if child process does not match */
if (waitstat != pid) {
- progerr(pkg_gt(ERR_WAIT_FAILED), pid, waitstat, status,
- errno, strerror(errno));
+ progerr(pkg_gt(ERR_WAIT_FAILED), pid, status,
+ errno, strerror(errno));
return (-1);
}
diff --git a/usr/src/lib/libpkg/common/pkglib.h b/usr/src/lib/libpkg/common/pkglib.h
index 04b17730ca..4e4bdabf91 100644
--- a/usr/src/lib/libpkg/common/pkglib.h
+++ b/usr/src/lib/libpkg/common/pkglib.h
@@ -403,8 +403,6 @@ struct dstr {
#define streq(a, b) (strcmp((a), (b)) == 0)
#define strneq(a, b, c) (strncmp((a), (b), (c)) == 0)
-#ifdef __STDC__
-
extern FILE *epopen(char *cmd, char *mode);
extern char **gpkglist(char *dir, char **pkg, char **catg);
extern int is_not_valid_length(char **category);
@@ -496,7 +494,7 @@ extern void checksum_off(void);
extern void checksum_on(void);
extern void cvtpath(char *path, char *copy);
extern void ds_order(char *list[]);
-extern void ds_putinfo(char *buf);
+extern void ds_putinfo(char *buf, size_t);
extern void ds_skiptoend(char *device);
extern void ecleanup(void);
/*PRINTFLIKE1*/
@@ -587,104 +585,6 @@ extern start_mode_t pkgservergetmode(void);
extern start_mode_t pkgparsemode(const char *);
extern char *pkgmodeargument(start_mode_t);
-
-#else /* __STDC__ */
-
-extern FILE *epopen();
-extern void pkglist_cont();
-extern char **gpkglist();
-extern char **pkgalias();
-extern char *get_prog_name();
-extern char *set_prog_name();
-extern int averify();
-extern int ckparam();
-extern int ckvolseq();
-extern int cverify();
-extern unsigned long compute_checksum();
-extern int fverify();
-extern char *getErrbufAddr();
-extern int getErrbufSize();
-extern char *getErrstr();
-extern void setErrstr();
-extern int devtype();
-extern int ds_close();
-extern int ds_findpkg();
-extern int ds_getinfo();
-extern int ds_getpkg();
-extern int ds_ginit();
-extern boolean_t ds_fd_open();
-extern int ds_init();
-extern int ds_next();
-extern int ds_readbuf();
-extern int epclose();
-extern int esystem();
-extern int e_ExecCmdArray();
-extern int e_ExecCmdList();
-extern int gpkgmap();
-extern int isFdRemote();
-extern int isFstypeRemote();
-extern int isPathRemote();
-extern int iscpio();
-extern int isdir();
-extern int isfile();
-extern int pkgexecl();
-extern int pkgexecv();
-extern int pkghead();
-extern int pkgmount();
-extern int pkgtrans();
-extern int pkgumount();
-extern int ppkgmap();
-extern int putcfile();
-extern int putcvfpfile();
-extern int rrmdir();
-extern int srchcfile();
-extern struct group *cgrgid();
-extern struct group *cgrnam();
-extern struct passwd *cpwnam();
-extern struct passwd *cpwuid();
-extern void basepath();
-extern void canonize();
-extern void canonize_slashes();
-extern void checksum_off();
-extern void checksum_on();
-extern void cvtpath();
-extern void ds_order();
-extern void ds_putinfo();
-extern void ds_skiptoend();
-extern void ecleanup();
-extern void logerr();
-extern int mappath();
-extern int mapvar();
-extern void progerr();
-extern void rpterr();
-extern void tputcfent();
-extern void set_nonABI_symlinks();
-extern int nonABI_symlinks();
-extern void disable_attribute_check();
-extern int get_disable_attribute_check();
-/* vfpops.c */
-extern int vfpCheckpointFile();
-extern int vfpCheckpointOpen();
-extern int vfpClearModified();
-extern int vfpClose();
-extern int vfpGetModified();
-extern int vfpOpen();
-extern void vfpRewind();
-extern int vfpSetFlags();
-extern int vfpSetModified();
-extern int vfpSetSize();
-extern void vfpTruncate();
-extern int vfpWriteToFile();
-
-/* handlelocalfs.c */
-boolean_t enable_local_fs();
-boolean_t restore_local_fs();
-
-/* gpkgmap.c */
-int getmapmode(void);
-
-#endif /* __STDC__ */
-
#ifdef __cplusplus
}
#endif
diff --git a/usr/src/lib/libpkg/common/pkglibmsgs.h b/usr/src/lib/libpkg/common/pkglibmsgs.h
index cf77b0f57a..4b811ca6ae 100644
--- a/usr/src/lib/libpkg/common/pkglibmsgs.h
+++ b/usr/src/lib/libpkg/common/pkglibmsgs.h
@@ -209,7 +209,7 @@ extern "C" {
#define MSG_KEYSTORE_UNKNOWN "Unknown"
/* parameter errors */
-#define ERR_LEN "length of parameter value <%s> exceeds limit"
+#define ERR_LEN "length of parameter <%s> value exceeds limit"
#define ERR_ASCII "parameter <%s> must be ascii"
#define ERR_ALNUM "parameter <%s> must be alphanumeric"
#define ERR_CHAR "parameter <%s> has incorrect first character"
@@ -235,7 +235,8 @@ extern "C" {
#define MSG_PKGNAME "- invalid package name in datastream table-of-contents"
#define MSG_NOPKG "- package <%s> not in datastream"
#define MSG_STATFS "- unable to stat filesystem, errno=%d"
-#define MSG_NOSPACE "- not enough space, %d blocks required, %d available"
+#define MSG_NOSPACE "- not enough space, %ld blocks required, "\
+ "%lld available"
/* pkglist errors */
#define ERR_MEMORY "memory allocation failure, errno=%d"
@@ -271,7 +272,7 @@ extern "C" {
#define LABEL3 "Insert %%v into %%p."
/* package verify errors */
-#define MSG_WLDDEVNO "NOTE: <%s> created as device (%d, %d)."
+#define MSG_WLDDEVNO "NOTE: <%s> created as device (%ld, %ld)."
#define WRN_QV_SIZE "WARNING: quick verify of <%s>; wrong size."
#define WRN_QV_MTIME "WARNING: quick verify of <%s>; wrong mod time."
@@ -288,8 +289,9 @@ extern "C" {
#define ERR_CKSUM "file cksum <%ld> expected <%ld> actual"
#define ERR_NO_CKSUM "unable to checksum, may need to re-run command as " \
"user \"root\""
-#define ERR_MAJMIN "major/minor device <%d, %d> expected <%d, %d> actual"
-#define ERR_PERM "permissions <%04o> expected <%04o> actual"
+#define ERR_MAJMIN "major/minor device <%ld, %ld> " \
+ "expected <%ld, %ld> actual"
+#define ERR_PERM "permissions <%04lo> expected <%04lo> actual"
#define ERR_GROUP "group name <%s> expected <%s> actual"
#define ERR_OWNER "owner name <%s> expected <%s> actual"
#define ERR_MODFAIL "unable to fix modification time"
@@ -325,8 +327,8 @@ extern "C" {
#define ERR_TOO_MANY_ARGS "too many arguments passed to pkgexecl " \
"for command <%s>"
-#define ERR_WAIT_FAILED "wait for process %ld failed, pid <%ld> status " \
- "<0x%08lx> errno <%d> (%s)"
+#define ERR_WAIT_FAILED "wait for process %ld failed, status " \
+ "<0x%08x> errno <%d> (%s)"
#define ERR_FORK_FAILED "fork() failed errno=%d (%s)"
#define ERR_FREOPEN "freopen(%s, \"%s\", %s) failed, errno=%d (%s)"
#define ERR_FDOPEN "fdopen(%d, \"%s\") failed, errno=%d (%s)"
diff --git a/usr/src/lib/libpkg/common/pkgmount.c b/usr/src/lib/libpkg/common/pkgmount.c
index e3c560ec70..1b64f0adc5 100644
--- a/usr/src/lib/libpkg/common/pkgmount.c
+++ b/usr/src/lib/libpkg/common/pkgmount.c
@@ -43,7 +43,6 @@
#include "pkglibmsgs.h"
#include "pkglocale.h"
-extern void quit(int retcode); /* Expected to be declared by caller! */
/* libadm.a */
extern int getvol(char *device, char *label, int options, char *prompt);
@@ -63,16 +62,16 @@ pkgmount(struct pkgdev *devp, char *pkg, int part, int nparts, int getvolflg)
if (part && nparts) {
if (pkg) {
- (void) sprintf(prompt, pkg_gt(LABEL0), part,
- nparts, pkg);
+ (void) snprintf(prompt, sizeof (prompt),
+ pkg_gt(LABEL0), part, nparts, pkg);
} else {
- (void) sprintf(prompt, pkg_gt(LABEL1), part,
- nparts);
+ (void) snprintf(prompt, sizeof (prompt),
+ pkg_gt(LABEL1), part, nparts);
}
} else if (pkg)
- (void) sprintf(prompt, pkg_gt(LABEL2), pkg);
+ (void) snprintf(prompt, sizeof (prompt), pkg_gt(LABEL2), pkg);
else
- (void) sprintf(prompt, pkg_gt(LABEL3));
+ (void) snprintf(prompt, sizeof (prompt), pkg_gt(LABEL3));
n = 0;
for (;;) {
@@ -96,7 +95,8 @@ pkgmount(struct pkgdev *devp, char *pkg, int part, int nparts, int getvolflg)
}
if (devp->fstyp == NULL) {
- (void) sprintf(cmd, "%s %s", FSTYP, devp->bdevice);
+ (void) snprintf(cmd, sizeof (cmd),
+ "%s %s", FSTYP, devp->bdevice);
if ((pp = epopen(cmd, "r")) == NULL) {
rpterr();
logerr(pkg_gt(ERR_FSTYP), devp->bdevice);
@@ -158,7 +158,7 @@ pkgumount(struct pkgdev *devp)
if (n != 0) {
progerr(pkg_gt("retrying umount of %s"),
devp->bdevice);
- sleep(5);
+ (void) sleep(5);
}
}
if (n == 0)
diff --git a/usr/src/lib/libpkg/common/pkgserv.c b/usr/src/lib/libpkg/common/pkgserv.c
index 176600e7b3..785f275dfc 100644
--- a/usr/src/lib/libpkg/common/pkgserv.c
+++ b/usr/src/lib/libpkg/common/pkgserv.c
@@ -358,7 +358,7 @@ openserver:
assert(args <= sizeof (cmd)/sizeof (char *));
if (posix_spawn(&pid, PKGSERV_PATH, NULL, NULL, cmd, environ) == 0) {
- server->onetime |= mode == RUN_ONCE;
+ server->onetime |= (mode == RUN_ONCE);
while (wait4(pid, &stat, 0, NULL) != -1) {
if (WIFEXITED(stat)) {
int s = WEXITSTATUS(stat);
@@ -434,6 +434,7 @@ pkgmodeargument(start_mode_t mode)
}
progerr(gettext("Bad pkgserv mode: %d"), (int)mode);
exit(99);
+ /*NOTREACHED*/
}
void
diff --git a/usr/src/lib/libpkg/common/pkgtrans.c b/usr/src/lib/libpkg/common/pkgtrans.c
index dbaaa73adf..a717360580 100644
--- a/usr/src/lib/libpkg/common/pkgtrans.c
+++ b/usr/src/lib/libpkg/common/pkgtrans.c
@@ -51,6 +51,7 @@
#include <openssl/pkcs7.h>
#include <openssl/err.h>
#include <openssl/pem.h>
+#include <note.h>
#include "pkginfo.h"
#include "pkgstrct.h"
#include "pkgtrans.h"
@@ -114,7 +115,7 @@ static int ckoverwrite(char *dir, char *inst, int options);
static int pkgxfer(char *srcinst, int options);
static int wdsheader(struct dm_buf *, char *src, char *device,
char **pkg, PKCS7 *);
-static struct dm_buf *genheader(char *, char *, char **);
+static struct dm_buf *genheader(char *, char **);
static int dump_hdr_and_pkgs(BIO *, struct dm_buf *, char **);
@@ -286,7 +287,7 @@ _pkgtrans(char *device1, char *device2, char **pkg, int options,
/* initialize PKCS7 object to be filled in later */
sec_pkcs7 = PKCS7_new();
- PKCS7_set_type(sec_pkcs7, NID_pkcs7_signed);
+ (void) PKCS7_set_type(sec_pkcs7, NID_pkcs7_signed);
sec_signerinfo = PKCS7_add_signature(sec_pkcs7,
pubcert, privkey, EVP_sha1());
@@ -298,7 +299,7 @@ _pkgtrans(char *device1, char *device2, char **pkg, int options,
}
/* add signer cert into signature */
- PKCS7_add_certificate(sec_pkcs7, pubcert);
+ (void) PKCS7_add_certificate(sec_pkcs7, pubcert);
/* attempt to resolve cert chain starting at the signer cert */
if (get_cert_chain(err, pubcert, clcerts, cacerts,
@@ -314,7 +315,7 @@ _pkgtrans(char *device1, char *device2, char **pkg, int options,
* since it's baked in already, so skip it
*/
for (i = 1; i < sk_X509_num(sec_chain); i++) {
- PKCS7_add_certificate(sec_pkcs7,
+ (void) PKCS7_add_certificate(sec_pkcs7,
sk_X509_value(sec_chain, i));
}
@@ -526,14 +527,14 @@ _pkgtrans(char *device1, char *device2, char **pkg, int options,
logerr(pkg_gt(MSG_GETVOL));
return (1);
}
- if ((hdr = genheader(src, ods_name, pkg)) == NULL) {
+ if ((hdr = genheader(src, pkg)) == NULL) {
cleanup();
return (1);
}
if (making_sig) {
/* start up signature data stream */
- PKCS7_content_new(sec_pkcs7, NID_pkcs7_data);
- PKCS7_set_detached(sec_pkcs7, 1);
+ (void) PKCS7_content_new(sec_pkcs7, NID_pkcs7_data);
+ (void) PKCS7_set_detached(sec_pkcs7, 1);
p7_bio = PKCS7_dataInit(sec_pkcs7, NULL);
/*
@@ -568,7 +569,7 @@ _pkgtrans(char *device1, char *device2, char **pkg, int options,
return (1);
}
- BIO_free(p7_bio);
+ (void) BIO_free(p7_bio);
}
/* write out header to stream, which includes signature */
@@ -767,13 +768,14 @@ cat_and_count(struct dm_buf *buf_ctrl, char *append)
}
static struct dm_buf *
-genheader(char *src, char *device, char **pkg)
+genheader(char *src, char **pkg)
{
FILE *fp;
char path[MAXPATHLEN], tmp_entry[ENTRY_MAX];
int i, n, nparts, maxpsize;
- int partcnt, totsize;
+ int partcnt;
+ long totsize;
struct stat statbuf;
if ((hdrbuf.text_buffer = (char *)malloc(BLK_SIZE)) == NULL) {
@@ -841,7 +843,8 @@ genheader(char *src, char *device, char **pkg)
if (dstdev.capacity && maxpsize > dstdev.capacity) {
progerr(pkg_gt(ERR_TRANSFER));
- logerr(pkg_gt(MSG_NOSPACE));
+ logerr(pkg_gt(MSG_NOSPACE), (long)maxpsize,
+ dstdev.capacity);
(void) fclose(fp);
ecleanup();
return (NULL);
@@ -867,15 +870,6 @@ genheader(char *src, char *device, char **pkg)
totsize += nparts * maxpsize;
if (dstdev.capacity && dstdev.capacity < totsize) {
int lastpartcnt = 0;
-#if 0
- if (i != 0) {
- progerr(pkg_gt(ERR_TRANSFER));
- logerr(pkg_gt(MSG_NOSPACE));
- (void) fclose(fp);
- ecleanup();
- return (NULL);
- }
-#endif /* 0 */
if (totsize)
totsize -= nparts * maxpsize;
@@ -969,7 +963,7 @@ wdsheader(struct dm_buf *hdr, char *src, char *device, char **pkg, PKCS7 *sig)
*/
for (block_cnt = 0; block_cnt < hdr->allocation;
block_cnt += BLK_SIZE) {
- write(ds_fd, (hdr->text_buffer + block_cnt), BLK_SIZE);
+ (void) write(ds_fd, (hdr->text_buffer + block_cnt), BLK_SIZE);
}
/*
@@ -978,9 +972,9 @@ wdsheader(struct dm_buf *hdr, char *src, char *device, char **pkg, PKCS7 *sig)
* for all packages
*/
(void) tmpnam(tmp_file); /* temporary file name */
- if ((list_fd = open(tmp_file, O_RDWR | O_CREAT)) == -1) {
+ if ((list_fd = open(tmp_file, O_RDWR | O_CREAT, 0644)) == -1) {
progerr(pkg_gt(ERR_TRANSFER));
- logerr(pkg_gt(MSG_NOTMPFIL));
+ logerr(pkg_gt(MSG_NOTMPFIL), tmp_file);
return (1);
}
@@ -1004,7 +998,7 @@ wdsheader(struct dm_buf *hdr, char *src, char *device, char **pkg, PKCS7 *sig)
if (write(list_fd, tmp_entry,
entry_size) != entry_size) {
progerr(pkg_gt(ERR_TRANSFER));
- logerr(pkg_gt(MSG_NOTMPFIL));
+ logerr(pkg_gt(MSG_NOTMPFIL), tmp_file);
(void) close(list_fd);
ecleanup();
return (1);
@@ -1045,20 +1039,22 @@ wdsheader(struct dm_buf *hdr, char *src, char *device, char **pkg, PKCS7 *sig)
cleanup();
return (1);
}
- PEM_write_PKCS7(fp, sig);
+ (void) PEM_write_PKCS7(fp, sig);
(void) fclose(fp);
for (i = 0; pkg[i]; i++) {
- sprintf(path, "%s/%s", tmpsymdir, pkg[i]);
+ (void) snprintf(path, sizeof (path),
+ "%s/%s", tmpsymdir, pkg[i]);
if (mkdir(path, 0755)) {
progerr(pkg_gt(ERR_TRANSFER));
logerr(pkg_gt(MSG_MKDIR), path);
cleanup();
return (1);
}
- sprintf(path, "%s/%s/%s", tmpsymdir,
- pkg[i], PKGINFO);
- sprintf(srcpath, "%s/%s/%s", src, pkg[i], PKGINFO);
+ (void) snprintf(path, sizeof (path),
+ "%s/%s/%s", tmpsymdir, pkg[i], PKGINFO);
+ (void) snprintf(srcpath, sizeof (srcpath),
+ "%s/%s/%s", src, pkg[i], PKGINFO);
if (symlink(srcpath, path) != 0) {
progerr(pkg_gt(ERR_TRANSFER));
logerr(pkg_gt(MSG_SYMLINK), path, srcpath);
@@ -1066,9 +1062,10 @@ wdsheader(struct dm_buf *hdr, char *src, char *device, char **pkg, PKCS7 *sig)
return (1);
}
- sprintf(path, "%s/%s/%s", tmpsymdir,
- pkg[i], PKGMAP);
- sprintf(srcpath, "%s/%s/%s", src, pkg[i], PKGMAP);
+ (void) snprintf(path, sizeof (path),
+ "%s/%s/%s", tmpsymdir, pkg[i], PKGMAP);
+ (void) snprintf(srcpath, sizeof (srcpath),
+ "%s/%s/%s", src, pkg[i], PKGMAP);
if (symlink(srcpath, path) != 0) {
progerr(pkg_gt(ERR_TRANSFER));
logerr(pkg_gt(MSG_SYMLINK), path, srcpath);
@@ -1081,14 +1078,14 @@ wdsheader(struct dm_buf *hdr, char *src, char *device, char **pkg, PKCS7 *sig)
* temporary string allowing for the first line
* as a special case.
*/
- entry_size = sprintf(tmp_entry,
+ entry_size = snprintf(tmp_entry, sizeof (tmp_entry),
(i == 0) ? "%s/%s\n%s/%s" : "\n%s/%s\n%s/%s",
pkg[i], PKGINFO, pkg[i], PKGMAP);
if (write(list_fd, tmp_entry,
entry_size) != entry_size) {
progerr(pkg_gt(ERR_TRANSFER));
- logerr(pkg_gt(MSG_NOTMPFIL));
+ logerr(pkg_gt(MSG_NOTMPFIL), tmp_file);
(void) close(list_fd);
ecleanup();
cleanup();
@@ -1097,7 +1094,8 @@ wdsheader(struct dm_buf *hdr, char *src, char *device, char **pkg, PKCS7 *sig)
}
/* add signature to list of files */
- entry_size = sprintf(tmp_entry, "\n%s", SIGNATURE_FILENAME);
+ entry_size = snprintf(tmp_entry, sizeof (tmp_entry), "\n%s",
+ SIGNATURE_FILENAME);
if (write(list_fd, tmp_entry, entry_size) != entry_size) {
progerr(pkg_gt(ERR_TRANSFER));
logerr(pkg_gt(MSG_NOTMPFIL), tmp_file);
@@ -1111,26 +1109,16 @@ wdsheader(struct dm_buf *hdr, char *src, char *device, char **pkg, PKCS7 *sig)
(void) lseek(list_fd, 0, SEEK_SET);
if (!making_sig) {
-#ifndef SUNOS41
- (void) sprintf(tmp_entry, "%s -ocD -C %d",
- CPIOPROC, (int)BLK_SIZE);
-#else
- (void) sprintf(tmp_entry, "%s -oc -C %d",
- CPIOPROC, (int)BLK_SIZE);
-#endif
+ (void) snprintf(tmp_entry, sizeof (tmp_entry),
+ "%s -ocD -C %d", CPIOPROC, (int)BLK_SIZE);
} else {
/*
* when making a signature, we must make sure to follow
* symlinks during the cpio so that we don't archive
* the links themselves
*/
-#ifndef SUNOS41
- (void) sprintf(tmp_entry, "%s -ocDL -C %d",
- CPIOPROC, (int)BLK_SIZE);
-#else
- (void) sprintf(tmp_entry, "%s -ocL -C %d",
- CPIOPROC, (int)BLK_SIZE);
-#endif
+ (void) snprintf(tmp_entry, sizeof (tmp_entry),
+ "%s -ocDL -C %d", CPIOPROC, (int)BLK_SIZE);
}
if (making_sig) {
@@ -1180,7 +1168,7 @@ ckoverwrite(char *dir, char *inst, int options)
{
char path[PATH_MAX];
- (void) sprintf(path, "%s/%s", dir, inst);
+ (void) snprintf(path, sizeof (path), "%s/%s", dir, inst);
if (access(path, 0) == 0) {
if (options & PT_OVERWRITE)
return (rrmdir(path));
@@ -1223,11 +1211,12 @@ pkgxfer(char *srcinst, int options)
if (!(options & PT_SILENT))
(void) fprintf(stderr, pkg_gt(MSG_TRANSFER), srcinst);
- (void) strcpy(dstinst, srcinst);
+ (void) strlcpy(dstinst, srcinst, sizeof (dstinst));
if (!(options & PT_ODTSTREAM)) {
/* destination is a (possibly mounted) directory */
- (void) sprintf(dstdir, "%s/%s", dst, dstinst);
+ (void) snprintf(dstdir, sizeof (dstdir),
+ "%s/%s", dst, dstinst);
/*
* need to check destination directory to assure
@@ -1244,10 +1233,10 @@ pkgxfer(char *srcinst, int options)
}
pkgdir = dst;
- (void) strcpy(temp, srcinst);
+ (void) strlcpy(temp, srcinst, sizeof (temp));
if (pt = strchr(temp, '.'))
*pt = '\0';
- (void) strcat(temp, ".*");
+ (void) strlcat(temp, ".*", sizeof (temp));
if (pt = fpkginst(temp, info.arch, info.version)) {
/*
@@ -1255,8 +1244,9 @@ pkgxfer(char *srcinst, int options)
* its pkgid might be different
*/
if (options & PT_OVERWRITE) {
- (void) strcpy(dstinst, pt);
- (void) sprintf(dstdir, "%s/%s", dst, dstinst);
+ (void) strlcpy(dstinst, pt, sizeof (dstinst));
+ (void) snprintf(dstdir, sizeof (dstdir),
+ "%s/%s", dst, dstinst);
} else {
progerr(pkg_gt(ERR_TRANSFER));
logerr(pkg_gt(MSG_DUPVERS), srcinst);
@@ -1273,8 +1263,10 @@ pkgxfer(char *srcinst, int options)
if (pt = strchr(temp, '.'))
*pt = '\0';
for (i = 2; (access(dstdir, 0) == 0); i++) {
- (void) sprintf(dstinst, "%s.%d", temp, i);
- (void) sprintf(dstdir, "%s/%s", dst, dstinst);
+ (void) snprintf(dstinst, sizeof (dstinst),
+ "%s.%d", temp, i);
+ (void) snprintf(dstdir, sizeof (dstdir),
+ "%s/%s", dst, dstinst);
}
} else if (options & PT_OVERWRITE) {
/*
@@ -1300,7 +1292,8 @@ pkgxfer(char *srcinst, int options)
return (1);
}
- (void) sprintf(srcdir, "%s/%s", src, srcinst);
+ (void) snprintf(srcdir, sizeof (srcdir),
+ "%s/%s", src, srcinst);
if (stat(srcdir, &srcstat) != -1) {
if (chmod(dstdir, (srcstat.st_mode & S_IAMB)) == -1) {
progerr(pkg_gt(ERR_TRANSFER));
@@ -1317,7 +1310,7 @@ pkgxfer(char *srcinst, int options)
if (!(options & PT_SILENT) && strcmp(dstinst, srcinst))
(void) fprintf(stderr, pkg_gt(MSG_RENAME), dstinst);
- (void) sprintf(srcdir, "%s/%s", src, srcinst);
+ (void) snprintf(srcdir, sizeof (srcdir), "%s/%s", src, srcinst);
if (chdir(srcdir)) {
progerr(pkg_gt(ERR_TRANSFER));
logerr(pkg_gt(MSG_CHDIR), srcdir);
@@ -1328,7 +1321,8 @@ pkgxfer(char *srcinst, int options)
/*
* transfer pkginfo & pkgmap first
*/
- (void) sprintf(cmd, "%s -pudm %s", CPIOPROC, dstdir);
+ (void) snprintf(cmd, sizeof (cmd),
+ "%s -pudm %s", CPIOPROC, dstdir);
if ((pp = epopen(cmd, "w")) == NULL) {
rpterr();
progerr(pkg_gt(ERR_TRANSFER));
@@ -1337,11 +1331,11 @@ pkgxfer(char *srcinst, int options)
}
(void) fprintf(pp, "%s\n%s\n", PKGINFO, PKGMAP);
- sighold(SIGINT);
- sighold(SIGHUP);
+ (void) sighold(SIGINT);
+ (void) sighold(SIGHUP);
r = epclose(pp);
- sigrelse(SIGINT);
- sigrelse(SIGHUP);
+ (void) sigrelse(SIGINT);
+ (void) sigrelse(SIGHUP);
if (r != 0) {
rpterr();
@@ -1415,11 +1409,11 @@ pkgxfer(char *srcinst, int options)
}
(void) fprintf(pp, "pkginfo");
- sighold(SIGINT);
- sighold(SIGHUP);
+ (void) sighold(SIGINT);
+ (void) sighold(SIGHUP);
r = epclose(pp);
- sigrelse(SIGINT);
- sigrelse(SIGHUP);
+ (void) sigrelse(SIGINT);
+ (void) sigrelse(SIGHUP);
if (r != 0) {
rpterr();
@@ -1467,10 +1461,12 @@ pkgxfer(char *srcinst, int options)
char line[128];
(void) mgets(line, 128);
curpartcnt = -1;
- if (sscanf(line, "%s %d %d %[ 0-9]", &pkgname, &nparts,
+ /* LINTED E_SEC_SCANF_UNBOUNDED_COPY */
+ if (sscanf(line, "%s %d %d %[ 0-9]", pkgname, &nparts,
&maxpartsize, volnos) == 4) {
- sscanf(volnos, "%d %[ 0-9]", &curpartcnt, tmpvol);
- strcpy(volnos, tmpvol);
+ (void) sscanf(volnos,
+ "%d %[ 0-9]", &curpartcnt, tmpvol);
+ (void) strlcpy(volnos, tmpvol, sizeof (volnos));
}
}
@@ -1500,7 +1496,7 @@ pkgxfer(char *srcinst, int options)
}
(void) sscanf(volnos, "%d %[ 0-9]", &index, tmpvol);
- (void) strcpy(volnos, tmpvol);
+ (void) strlcpy(volnos, tmpvol, sizeof (volnos));
curpartcnt += index;
}
@@ -1508,59 +1504,61 @@ pkgxfer(char *srcinst, int options)
nparts = 0;
if (part == 1) {
- (void) sprintf(cmd, "find %s %s", PKGINFO, PKGMAP);
+ (void) snprintf(cmd, sizeof (cmd),
+ "find %s %s", PKGINFO, PKGMAP);
if (nparts && (isdir(INSTALL) == 0)) {
- (void) strcat(cmd, " ");
- (void) strcat(cmd, INSTALL);
+ (void) strlcat(cmd, " ", sizeof (cmd));
+ (void) strlcat(cmd, INSTALL, sizeof (cmd));
}
} else
- (void) sprintf(cmd, "find %s", PKGINFO);
+ (void) snprintf(cmd, sizeof (cmd), "find %s", PKGINFO);
if (nparts > 1) {
- (void) sprintf(temp, "%s.%d", RELOC, part);
+ (void) snprintf(temp, sizeof (temp),
+ "%s.%d", RELOC, part);
if (iscpio(temp, &iscomp) || isdir(temp) == 0) {
- (void) strcat(cmd, " ");
- (void) strcat(cmd, temp);
+ (void) strlcat(cmd, " ", sizeof (cmd));
+ (void) strlcat(cmd, temp, sizeof (cmd));
}
- (void) sprintf(temp, "%s.%d", ROOT, part);
+ (void) snprintf(temp, sizeof (temp),
+ "%s.%d", ROOT, part);
if (iscpio(temp, &iscomp) || isdir(temp) == 0) {
- (void) strcat(cmd, " ");
- (void) strcat(cmd, temp);
+ (void) strlcat(cmd, " ", sizeof (cmd));
+ (void) strlcat(cmd, temp, sizeof (cmd));
}
- (void) sprintf(temp, "%s.%d", ARCHIVE, part);
+ (void) snprintf(temp, sizeof (temp),
+ "%s.%d", ARCHIVE, part);
if (isdir(temp) == 0) {
- (void) strcat(cmd, " ");
- (void) strcat(cmd, temp);
+ (void) strlcat(cmd, " ", sizeof (cmd));
+ (void) strlcat(cmd, temp, sizeof (cmd));
}
} else if (nparts) {
for (i = 0; reloc_names[i] != NULL; i++) {
if (iscpio(reloc_names[i], &iscomp) ||
isdir(reloc_names[i]) == 0) {
- (void) strcat(cmd, " ");
- (void) strcat(cmd, reloc_names[i]);
+ (void) strlcat(cmd, " ", sizeof (cmd));
+ (void) strlcat(cmd, reloc_names[i],
+ sizeof (cmd));
}
}
for (i = 0; root_names[i] != NULL; i++) {
if (iscpio(root_names[i], &iscomp) ||
isdir(root_names[i]) == 0) {
- (void) strcat(cmd, " ");
- (void) strcat(cmd, root_names[i]);
+ (void) strlcat(cmd, " ", sizeof (cmd));
+ (void) strlcat(cmd, root_names[i],
+ sizeof (cmd));
}
}
if (isdir(ARCHIVE) == 0) {
- (void) strcat(cmd, " ");
- (void) strcat(cmd, ARCHIVE);
+ (void) strlcat(cmd, " ", sizeof (cmd));
+ (void) strlcat(cmd, ARCHIVE, sizeof (cmd));
}
}
if (options & PT_ODTSTREAM) {
-#ifndef SUNOS41
- (void) sprintf(cmd+strlen(cmd),
+ (void) snprintf(cmd + strlen(cmd),
+ sizeof (cmd) - strlen(cmd),
" -print | %s -ocD -C %d",
-#else
- (void) sprintf(cmd+strlen(cmd),
- " -print | %s -oc -C %d",
-#endif
- CPIOPROC, (int)BLK_SIZE);
+ CPIOPROC, (int)BLK_SIZE);
} else {
if (statvfs64(dstdir, &svfsb) == -1) {
progerr(pkg_gt(ERR_TRANSFER));
@@ -1575,11 +1573,16 @@ pkgxfer(char *srcinst, int options)
if ((has_comp_size ? compressedsize : maxpartsize) >
free_blocks) {
progerr(pkg_gt(ERR_TRANSFER));
- logerr(pkg_gt(MSG_NOSPACE));
+ logerr(pkg_gt(MSG_NOSPACE),
+ has_comp_size ?
+ (long)compressedsize : (long)maxpartsize,
+ free_blocks);
return (1);
}
- (void) sprintf(cmd+strlen(cmd), " -print | %s -pdum %s",
- CPIOPROC, dstdir);
+ (void) snprintf(cmd + strlen(cmd),
+ sizeof (cmd) - strlen(cmd),
+ " -print | %s -pdum %s",
+ CPIOPROC, dstdir);
}
n = esystem(cmd, -1, (options & PT_ODTSTREAM) ? ds_fd : -1);
@@ -1604,14 +1607,14 @@ pkgxfer(char *srcinst, int options)
return (n);
if (chdir(srcdir)) {
progerr(pkg_gt(ERR_TRANSFER));
- logerr(pkg_gt(MSG_CORRUPT), srcdir);
+ logerr(pkg_gt(MSG_CORRUPT));
(void) chdir("/");
- pkgumount(&srcdev);
+ (void) pkgumount(&srcdev);
continue;
}
if (ckvolseq(srcdir, part, nparts)) {
(void) chdir("/");
- pkgumount(&srcdev);
+ (void) pkgumount(&srcdev);
continue;
}
break;
@@ -1667,7 +1670,7 @@ pkgxfer(char *srcinst, int options)
(void) sscanf(volnos, "%d %[ 0-9]", &index,
tmpvol);
- (void) strcpy(volnos, tmpvol);
+ (void) strlcpy(volnos, tmpvol, sizeof (volnos));
curpartcnt += index;
}
}
@@ -1738,8 +1741,8 @@ pkgdump(char *srcinst, BIO *bio)
(void) snprintf(cmd, CMDSIZE, "find %s %s",
PKGINFO, PKGMAP);
if (nparts && (isdir(INSTALL) == 0)) {
- (void) strcat(cmd, " ");
- (void) strcat(cmd, INSTALL);
+ (void) strlcat(cmd, " ", sizeof (cmd));
+ (void) strlcat(cmd, INSTALL, sizeof (cmd));
}
} else
(void) snprintf(cmd, CMDSIZE, "find %s", PKGINFO);
@@ -1784,14 +1787,10 @@ pkgdump(char *srcinst, BIO *bio)
}
}
-#ifndef SUNOS41
- (void) sprintf(cmd+strlen(cmd),
+ (void) snprintf(cmd + strlen(cmd),
+ sizeof (cmd) - strlen(cmd),
" -print | %s -ocD -C %d",
-#else
- (void) sprintf(cmd+strlen(cmd),
- " -print | %s -oc -C %d",
-#endif
- CPIOPROC, (int)BLK_SIZE);
+ CPIOPROC, (int)BLK_SIZE);
/*
* execute the command, dumping all standard output
* to the BIO.
@@ -1812,37 +1811,38 @@ pkgdump(char *srcinst, BIO *bio)
static void
sigtrap(int signo)
{
+ _NOTE(ARGUNUSED(signo));
signal_received++;
}
static void
cleanup(void)
{
- chdir("/");
+ (void) chdir("/");
if (tmpdir) {
- rrmdir(tmpdir);
+ (void) rrmdir(tmpdir);
free(tmpdir);
tmpdir = NULL;
}
if (tmppath) {
/* remove any previous tmppath stuff */
- rrmdir(tmppath);
+ (void) rrmdir(tmppath);
free(tmppath);
tmppath = NULL;
}
if (tmpsymdir) {
/* remove temp symbolic links made for signed pkg */
- rrmdir(tmpsymdir);
+ (void) rrmdir(tmpsymdir);
free(tmpsymdir);
tmpsymdir = NULL;
}
if (srcdev.mount && !ids_name)
- pkgumount(&srcdev);
+ (void) pkgumount(&srcdev);
if (dstdev.mount && !ods_name)
- pkgumount(&dstdev);
+ (void) pkgumount(&dstdev);
(void) ds_close(1);
}
@@ -1871,7 +1871,7 @@ dump_hdr_and_pkgs(BIO *bio, struct dm_buf *hdr, char **pkglist)
/* write out the header to the signature stream */
for (block_cnt = 0; block_cnt < hdr->allocation;
block_cnt += BLK_SIZE) {
- BIO_write(bio, (hdr->text_buffer + block_cnt), BLK_SIZE);
+ (void) BIO_write(bio, (hdr->text_buffer + block_cnt), BLK_SIZE);
}
/* save current directory */
@@ -1941,11 +1941,11 @@ BIO_dump_cmd(char *cmd, BIO *bio)
/* read output in chunks, transfer to BIO */
while (fread(buf, BLK_SIZE, 1, fp) == 1) {
if (BIO_write(bio, buf, BLK_SIZE) != BLK_SIZE) {
- sighold(SIGINT);
- sighold(SIGHUP);
+ (void) sighold(SIGINT);
+ (void) sighold(SIGHUP);
(void) epclose(fp);
- sigrelse(SIGINT);
- sigrelse(SIGHUP);
+ (void) sigrelse(SIGINT);
+ (void) sigrelse(SIGHUP);
rpterr();
return (1);
}
@@ -1959,11 +1959,11 @@ BIO_dump_cmd(char *cmd, BIO *bio)
}
/* done, close stream, report any errors */
- sighold(SIGINT);
- sighold(SIGHUP);
+ (void) sighold(SIGINT);
+ (void) sighold(SIGHUP);
rc = epclose(fp);
- sigrelse(SIGINT);
- sigrelse(SIGHUP);
+ (void) sigrelse(SIGINT);
+ (void) sigrelse(SIGHUP);
if (rc != 0) {
rpterr();
return (1);
diff --git a/usr/src/lib/libpkg/common/pkgweb.c b/usr/src/lib/libpkg/common/pkgweb.c
index 56559a0953..bcda3e53f2 100644
--- a/usr/src/lib/libpkg/common/pkgweb.c
+++ b/usr/src/lib/libpkg/common/pkgweb.c
@@ -617,6 +617,7 @@ cleanup:
*
* Returns : none
*/
+/*PRINTFLIKE2*/
void
echo_out(int nointeract, char *fmt, ...)
{
@@ -941,6 +942,7 @@ validate_signature(PKG_ERR *err, char *name, BIO *indata, PKCS7 *p7,
/* some other error. print them all. */
while ((errcode = ERR_get_error_line_data(NULL,
NULL, &err_data, &err_flags)) != 0) {
+ size_t errsz;
err_reason =
ERR_reason_error_string(errcode);
if (err_reason == NULL) {
@@ -952,11 +954,11 @@ validate_signature(PKG_ERR *err, char *name, BIO *indata, PKCS7 *p7,
err_data =
gettext(ERR_SIG_INT);
}
- err_string =
- xmalloc(strlen(err_reason) +
- strlen(err_data) + 3);
- (void) sprintf(err_string, "%s: %s",
- err_reason, err_data);
+ errsz = strlen(err_reason) +
+ strlen(err_data) + 3;
+ err_string = xmalloc(errsz);
+ (void) snprintf(err_string, errsz,
+ "%s: %s", err_reason, err_data);
pkgerr_add(err, PKGERR_VERIFY,
gettext(ERR_VERIFY_SIG),
signer_sname, signer_iname,
@@ -1263,7 +1265,7 @@ ocsp_verify(PKG_ERR *err, X509 *cert, X509 *issuer,
}
/* add nonce */
- OCSP_request_add1_nonce(req, NULL, -1);
+ (void) OCSP_request_add1_nonce(req, NULL, -1);
/* connect to host, or proxy */
if (proxy != NULL) {
@@ -2823,7 +2825,7 @@ dequote(char *str)
}
/* remove first quote */
- memmove(str, str + 1, strlen(str) - 1);
+ (void) memmove(str, str + 1, strlen(str) - 1);
/*
* scan string looking for ending quote.
@@ -3022,7 +3024,7 @@ backoff()
initted = B_TRUE;
}
- backoff = drand48() * (double)cur_backoff;
+ backoff = (int)(drand48() * (double)cur_backoff);
(void) sleep(backoff);
if (cur_backoff < MAX_BACKOFF) {
/*
@@ -3157,7 +3159,7 @@ pkg_passphrase_cb(char *buf, int size, int rw, void *data)
*/
/* make a copy (getpassphrase overwrites) */
- strlcpy(passphrase_copy, passphrase,
+ (void) strlcpy(passphrase_copy, passphrase,
MAX_PHRASELEN + 1);
if (((passlen = snprintf(prompt_copy,
@@ -3233,6 +3235,6 @@ pkg_passphrase_cb(char *buf, int size, int rw, void *data)
return (-1);
}
- strlcpy(buf, passphrase, size);
+ (void) strlcpy(buf, passphrase, size);
return (strlen(buf));
}
diff --git a/usr/src/lib/libpkg/common/pkgxpand.c b/usr/src/lib/libpkg/common/pkgxpand.c
deleted file mode 100644
index 7f92aa8420..0000000000
--- a/usr/src/lib/libpkg/common/pkgxpand.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-
-
-#include <stdio.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include "pkglib.h"
-#include "pkglocale.h"
-
-extern char *fpkginst(char *pkg, ...); /* libadm.a */
-extern char *pkgdir; /* WHERE? */
-
-#define ispkgalias(p) (*p == '+')
-#define LSIZE 512
-#define MALSIZ 16
-
-char **
-pkgalias(char *pkg)
-{
- FILE *fp;
- char path[PATH_MAX], *pkginst;
- char *mypkg, *myarch, *myvers, **pkglist;
- char line[LSIZE];
- int n, errflg;
-
- pkglist = (char **)calloc(MALSIZ, sizeof (char *));
- if (pkglist == NULL)
- return ((char **)0);
-
- (void) sprintf(path, "%s/%s/pkgmap", pkgdir, pkg);
- if ((fp = fopen(path, "r")) == NULL)
- return ((char **)0);
-
- n = errflg = 0;
- while (fgets(line, LSIZE, fp)) {
- mypkg = strtok(line, " \t\n");
- myarch = strtok(NULL, "( \t\n)");
- myvers = strtok(NULL, "\n");
-
- (void) fpkginst(NULL);
- pkginst = fpkginst(mypkg, myarch, myvers);
- if (pkginst == NULL) {
- logerr(
- pkg_gt("no package instance for [%s]"), mypkg);
- errflg++;
- continue;
- }
- if (errflg)
- continue;
-
- pkglist[n] = strdup(pkginst);
- if ((++n % MALSIZ) == 0) {
- pkglist = (char **)realloc(pkglist,
- (n+MALSIZ)*sizeof (char *));
- if (pkglist == NULL)
- return ((char **)0);
- }
- }
- pkglist[n] = NULL;
-
- (void) fclose(fp);
- if (errflg) {
- while (n-- >= 0)
- free(pkglist[n]);
- free(pkglist);
- return ((char **)0);
- }
- return (pkglist);
-}
-
-#if 0
-char **
-pkgxpand(char *pkg[])
-{
- static int level = 0;
- char **pkglist;
- int i;
-
- if (++level >= 0)
- printf(pkg_gt("too deep"));
- for (i = 0; pkg[i]; i++) {
- if (ispkgalias(pkg[i])) {
- pkglist = pkgxpand(&pkg[i]);
- pkgexpand(pkglist);
- }
- }
-}
-#endif /* 0 */
diff --git a/usr/src/lib/libpkg/common/ppkgmap.c b/usr/src/lib/libpkg/common/ppkgmap.c
index 423def1bab..e84255202b 100644
--- a/usr/src/lib/libpkg/common/ppkgmap.c
+++ b/usr/src/lib/libpkg/common/ppkgmap.c
@@ -65,40 +65,20 @@ ppkgmap(struct cfent *ept, FILE *fp)
}
if (strchr("cb", ept->ftype)) {
-#ifdef SUNOS41
- if (ept->ainfo.xmajor == BADMAJOR) {
- if (fprintf(fp, " ?") < 0)
- return (-1);
- } else {
- if (fprintf(fp, " %d", ept->ainfo.xmajor) < 0)
- return (-1);
- }
-#else
if (ept->ainfo.major == BADMAJOR) {
if (fprintf(fp, " ?") < 0)
return (-1);
} else {
- if (fprintf(fp, " %d", ept->ainfo.major) < 0)
- return (-1);
- }
-#endif
-#ifdef SUNOS41
- if (ept->ainfo.xminor == BADMINOR) {
- if (fprintf(fp, " ?") < 0)
- return (-1);
- } else {
- if (fprintf(fp, " %d", ept->ainfo.xminor) < 0)
+ if (fprintf(fp, " %ld", ept->ainfo.major) < 0)
return (-1);
}
-#else
if (ept->ainfo.minor == BADMINOR) {
if (fprintf(fp, " ?") < 0)
return (-1);
} else {
- if (fprintf(fp, " %d", ept->ainfo.minor) < 0)
+ if (fprintf(fp, " %ld", ept->ainfo.minor) < 0)
return (-1);
}
-#endif
}
if (strchr("dxcbpfve", ept->ftype)) {
diff --git a/usr/src/lib/libpkg/common/progerr.c b/usr/src/lib/libpkg/common/progerr.c
index 8feaf4b81b..e239dd8bda 100644
--- a/usr/src/lib/libpkg/common/progerr.c
+++ b/usr/src/lib/libpkg/common/progerr.c
@@ -74,7 +74,7 @@ get_prog_name(void)
}
-/*VARARGS*/
+/*PRINTFLIKE1*/
void
progerr(char *fmt, ...)
{
diff --git a/usr/src/lib/libpkg/common/putcfile.c b/usr/src/lib/libpkg/common/putcfile.c
index 959f2684b8..a55528a1a4 100644
--- a/usr/src/lib/libpkg/common/putcfile.c
+++ b/usr/src/lib/libpkg/common/putcfile.c
@@ -103,7 +103,7 @@ putcfile(struct cfent *a_ept, FILE *a_fp)
return (-1);
}
} else {
- if (fprintf(a_fp, " %d", a_ept->ainfo.major) < 0)
+ if (fprintf(a_fp, " %ld", a_ept->ainfo.major) < 0)
return (-1);
}
@@ -116,7 +116,7 @@ putcfile(struct cfent *a_ept, FILE *a_fp)
return (-1);
}
} else {
- if (fprintf(a_fp, " %d", a_ept->ainfo.minor) < 0)
+ if (fprintf(a_fp, " %ld", a_ept->ainfo.minor) < 0)
return (-1);
}
}
diff --git a/usr/src/lib/libpkg/common/runcmd.c b/usr/src/lib/libpkg/common/runcmd.c
index 945673737e..3be8d36ee2 100644
--- a/usr/src/lib/libpkg/common/runcmd.c
+++ b/usr/src/lib/libpkg/common/runcmd.c
@@ -62,30 +62,6 @@
static char errfile[L_tmpnam+1];
/*
- * This is the "argument array" definition that is returned by e_new_args and is
- * used by e_add_args, e_free_args, etc.
- */
-
-struct _argArray_t {
- long _aaNumArgs; /* number of arguments set */
- long _aaMaxArgs; /* number of arguments allocated */
- char **_aaArgs; /* actual arguments */
-};
-
-typedef struct _argArray_t argArray_t;
-
-/*
- * Private Methods
- */
-static void e_free_args(argArray_t *a_args);
-static argArray_t *e_new_args(int initialCount);
-/*PRINTFLIKE2*/
-static boolean_t e_add_arg(argArray_t *a_args, char *a_format, ...);
-static int e_get_argc(argArray_t *a_args);
-static char **e_get_argv(argArray_t *a_args);
-
-
-/*
* Public Methods
*/
@@ -99,7 +75,7 @@ rpterr(void)
if (errfile[0]) {
if (fp = fopen(errfile, "r")) {
while ((c = getc(fp)) != EOF)
- putc(c, stderr);
+ (void) putc(c, stderr);
(void) fclose(fp);
}
(void) unlink(errfile);
@@ -170,7 +146,7 @@ esystem(char *cmd, int ifd, int ofd)
i = open(errfile, O_WRONLY|O_CREAT|O_TRUNC, 0666);
if (i >= 0) {
- dup2(i, STDERR_FILENO);
+ (void) dup2(i, STDERR_FILENO);
}
/* Close all open files except standard i/o */
@@ -179,7 +155,7 @@ esystem(char *cmd, int ifd, int ofd)
/* execute target executable */
- execl("/sbin/sh", "/sbin/sh", "-c", cmd, NULL);
+ (void) execl("/sbin/sh", "/sbin/sh", "-c", cmd, NULL);
progerr(pkg_gt("exec of <%s> failed, errno=%d"), cmd, errno);
_exit(99);
} else if (pid < 0) {
@@ -193,9 +169,9 @@ esystem(char *cmd, int ifd, int ofd)
* this is the parent process
*/
- sighold(SIGINT);
+ (void) sighold(SIGINT);
pid = waitpid(pid, &status, 0);
- sigrelse(SIGINT);
+ (void) sigrelse(SIGINT);
if (pid < 0) {
return (-1); /* probably interrupted */
@@ -229,7 +205,7 @@ epopen(char *cmd, char *mode)
if (errfile[0]) {
/* cleanup previous errfile */
- unlink(errfile);
+ (void) unlink(errfile);
}
perrfile = tmpnam(NULL);
@@ -596,213 +572,3 @@ e_ExecCmdList(int *r_status, char **r_results,
return (e_ExecCmdArray(r_status, r_results, a_inputFile,
a_cmd, array));
}
-
-/*
- * Name: e_new_args
- * Description: create a new argument array for use in exec() calls
- * Arguments: initialCount - [RO, *RO] - (int)
- * Initial number of elements to populate the
- * argument array with - use best guess
- * Returns: argArray_t *
- * Pointer to argument array that can be used in other
- * functions that accept it as an argument
- * == (argArray_t *)NULL - error
- * NOTE: you must call e_free_args() when the returned argument array is
- * no longer needed so that all storage used can be freed up.
- */
-
-argArray_t *
-e_new_args(int initialCount)
-{
- argArray_t *aa;
-
- /* allocate new argument array structure */
-
- aa = (argArray_t *)calloc(1, sizeof (argArray_t));
- if (aa == (argArray_t *)NULL) {
- progerr(ERR_MALLOC, strerror(errno), sizeof (argArray_t),
- "<argArray_t>");
- return ((argArray_t *)NULL);
- }
-
- /* allocate initial argument array */
-
- aa->_aaArgs = (char **)calloc(initialCount+1, sizeof (char *));
- if (aa->_aaArgs == (char **)NULL) {
- progerr(ERR_MALLOC, strerror(errno),
- (initialCount+1)*sizeof (char *), "<char **>");
- return ((argArray_t *)NULL);
- }
-
- /* initialize argument indexes */
-
- aa->_aaNumArgs = 0;
- aa->_aaMaxArgs = initialCount;
-
- return (aa);
-}
-
-/*
- * Name: e_add_arg
- * Description: add new argument to argument array for use in exec() calls
- * Arguments: a_args - [RO, *RW] - (argArray_t *)
- * Pointer to argument array (previously allocated via
- * a call to e_new_args) to add the argument to
- * a_format - [RO, *RO] - (char *)
- * Pointer to "printf" style format argument
- * ... - [RO, *RO] - (varies)
- * Arguments as appropriate for format statement
- * Returns: boolean_t
- * B_TRUE - success
- * B_FALSE - failure
- * Examples:
- * - to add an argument that specifies a file descriptor:
- * int fd;
- * e_add_arg(aa, "/proc/self/fd/%d", fd);
- * - to add a flag or other known text:
- * e_add_arg(aa, "-s")
- * - to add random text:
- * char *random_text;
- * e_add_arg(aa, "%s", random_text);
- */
-
-/*PRINTFLIKE2*/
-boolean_t
-e_add_arg(argArray_t *a_args, char *a_format, ...)
-{
- char *rstr = (char *)NULL;
- char bfr[MAX_CANON];
- size_t vres = 0;
- va_list ap;
-
- /*
- * double argument array if array is full
- */
-
- if (a_args->_aaNumArgs >= a_args->_aaMaxArgs) {
- int newMax;
- char **newArgs;
-
- newMax = a_args->_aaMaxArgs * 2;
- newArgs = (char **)realloc(a_args->_aaArgs,
- (newMax+1) * sizeof (char *));
- if (newArgs == (char **)NULL) {
- progerr(ERR_MALLOC, strerror(errno),
- ((newMax+1) * sizeof (char *)), "<char **>");
- return (B_FALSE);
- }
- a_args->_aaArgs = newArgs;
- a_args->_aaMaxArgs = newMax;
- }
-
- /* determine size of argument to add to list */
-
- va_start(ap, a_format);
- vres = vsnprintf(bfr, sizeof (bfr), a_format, ap);
- va_end(ap);
-
- /* if it fit in the built in buffer, use that */
- if (vres < sizeof (bfr)) {
- /* dup text already generated in bfr */
- rstr = strdup(bfr);
- if (rstr == (char *)NULL) {
- progerr(ERR_MALLOC, strerror(errno), vres+2,
- "<char *>");
- return (B_FALSE);
- }
- } else {
- /* allocate space for argument to add */
-
- rstr = (char *)malloc(vres+2);
- if (rstr == (char *)NULL) {
- progerr(ERR_MALLOC, strerror(errno), vres+2,
- "<char *>");
- return (B_FALSE);
- }
-
- /* generate argument to add */
-
- va_start(ap, a_format);
- vres = vsnprintf(rstr, vres+1, a_format, ap);
- va_end(ap);
- }
-
- /* add argument to the end of the argument array */
-
- a_args->_aaArgs[a_args->_aaNumArgs++] = rstr;
- a_args->_aaArgs[a_args->_aaNumArgs] = (char *)NULL;
-
- return (B_TRUE);
-}
-
-/*
- * Name: e_get_argv
- * Description: return (char **)argv pointer from argument array
- * Arguments: a_args - [RO, *RW] - (argArray_t *)
- * Pointer to argument array (previously allocated via
- * a call to e_new_args) to return argv pointer for
- * Returns: char **
- * Pointer to (char **)argv pointer suitable for use
- * in an exec*() call
- * NOTE: the actual character array is always terminated with a (char *)NULL
- */
-
-char **
-e_get_argv(argArray_t *a_args)
-{
- return (a_args->_aaArgs);
-}
-
-/*
- * Name: e_get_argc
- * Description: return (int) argc count from argument array
- * Arguments: a_args - [RO, *RW] - (argArray_t *)
- * Pointer to argument array (previously allocated via
- * a call to e_new_args) to return argc count for
- * Returns: int
- * Count of the number of arguments in the argument array
- * suitable for use in an exec*() call
- */
-
-int
-e_get_argc(argArray_t *a_args)
-{
- return (a_args->_aaNumArgs);
-}
-
-/*
- * Name: e_free_args
- * Description: free all storage contained in an argument array previously
- * allocated by a call to e_new_args
- * Arguments: a_args - [RO, *RW] - (argArray_t *)
- * Pointer to argument array (previously allocated via
- * a call to e_new_args) to free
- * Returns: void
- * NOTE: preserves errno (usually called right after e_execCmd*())
- */
-
-void
-e_free_args(argArray_t *a_args)
-{
- int i;
- int lerrno = errno;
-
- /* free all arguments in the argument array */
-
- for (i = (a_args->_aaNumArgs-1); i >= 0; i--) {
- (void) free(a_args->_aaArgs[i]);
- a_args->_aaArgs[i] = (char *)NULL;
- }
-
- /* free argument array */
-
- (void) free(a_args->_aaArgs);
-
- /* free argument array structure */
-
- (void) free(a_args);
-
- /* restore errno */
-
- errno = lerrno;
-}
diff --git a/usr/src/lib/libpkg/common/tputcfent.c b/usr/src/lib/libpkg/common/tputcfent.c
index 492f0335af..11601ded9e 100644
--- a/usr/src/lib/libpkg/common/tputcfent.c
+++ b/usr/src/lib/libpkg/common/tputcfent.c
@@ -95,14 +95,14 @@ tputcfent(struct cfent *ept, FILE *fp)
(void) fprintf(fp, pkg_gt("Major device number: %s\n"),
MSG_INVALID);
else
- (void) fprintf(fp, pkg_gt("Major device number: %d\n"),
+ (void) fprintf(fp, pkg_gt("Major device number: %ld\n"),
ept->ainfo.major);
if (ept->ainfo.minor == BADMINOR)
(void) fprintf(fp, pkg_gt("Minor device number: %s\n"),
MSG_INVALID);
else
- (void) fprintf(fp, pkg_gt("Minor device number: %d\n"),
+ (void) fprintf(fp, pkg_gt("Minor device number: %ld\n"),
ept->ainfo.minor);
break;
@@ -131,7 +131,7 @@ tputcfent(struct cfent *ept, FILE *fp)
(void) fprintf(fp, pkg_gt("Expected mode: %s\n"),
"?");
else
- (void) fprintf(fp, pkg_gt("Expected mode: %04o\n"),
+ (void) fprintf(fp, pkg_gt("Expected mode: %04lo\n"),
ept->ainfo.mode);
(void) fprintf(fp, pkg_gt("Expected owner: %s\n"),
@@ -148,10 +148,10 @@ tputcfent(struct cfent *ept, FILE *fp)
ept->cinfo.cksum);
if (ept->cinfo.modtime > 0) {
timep = localtime(&(ept->cinfo.modtime));
- strftime(timeb, sizeof (timeb),
+ (void) strftime(timeb, sizeof (timeb),
pkg_gt("Expected last modification: %b %d %X %Y\n"),
timep);
- (void) fprintf(fp, timeb);
+ (void) fputs(timeb, fp);
} else
(void) fprintf(fp,
pkg_gt("Expected last modification: ?\n"));
diff --git a/usr/src/lib/libpkg/common/verify.c b/usr/src/lib/libpkg/common/verify.c
index c48c5b8c77..3329d9aff2 100644
--- a/usr/src/lib/libpkg/common/verify.c
+++ b/usr/src/lib/libpkg/common/verify.c
@@ -106,7 +106,6 @@ reperr(char *fmt, ...)
ptln = sizeof (theErrBuf);
}
va_start(ap, fmt);
- /* LINTED variable format specifier to vsnprintf() */
(void) vsnprintf(pt, ptln, fmt, ap);
va_end(ap);
}
@@ -421,7 +420,7 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
/* Get copy of the current working directory */
if (getcwd(cwd, MAXPATHLEN) == NULL) {
- reperr(pkg_gt(ERR_GETWD), ainfo->local);
+ reperr(pkg_gt(ERR_GETWD));
return (VE_FAIL);
}
@@ -434,7 +433,7 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
if (c) {
/* bugid 4247895 */
if (strcmp(cd, c) == 0)
- strcpy(cd, "/");
+ (void) strcpy(cd, "/");
else
*c = NULL;
@@ -454,7 +453,7 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
* directory.
*/
if (!isdir(ainfo->local)) {
- chdir(cwd);
+ (void) chdir(cwd);
reperr(pkg_gt(ERR_LINKISDIR),
ainfo->local);
return (VE_FAIL);
@@ -464,7 +463,7 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
return (VE_FAIL);
if (link(ainfo->local, path)) {
- chdir(cwd);
+ (void) chdir(cwd);
reperr(pkg_gt(ERR_LINKFAIL),
ainfo->local);
return (VE_FAIL);
@@ -660,11 +659,7 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
}
if (mknod(path, ainfo->mode | S_IFCHR,
-#ifdef SUNOS41
- makedev(ainfo->xmajor, ainfo->xminor)) ||
-#else
makedev(ainfo->major, ainfo->minor)) ||
-#endif
(stat(path, &status) < 0)) {
reperr(pkg_gt(ERR_CDEVFAIL));
return (VE_FAIL);
@@ -694,11 +689,7 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
}
if (mknod(path, ainfo->mode | S_IFBLK,
-#ifdef SUNOS41
- makedev(ainfo->xmajor, ainfo->xminor)) ||
-#else
makedev(ainfo->major, ainfo->minor)) ||
-#endif
(stat(path, &status) < 0)) {
reperr(pkg_gt(ERR_BDEVFAIL));
return (VE_FAIL);
@@ -723,19 +714,6 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
retcode = 0;
if ((myftype == 'c') || (myftype == 'b')) {
-#ifdef SUNOS41
- if (setval || (ainfo->xmajor < 0))
- ainfo->xmajor = ((status.st_rdev>>8)&0377);
- if (setval || (ainfo->xminor < 0))
- ainfo->xminor = (status.st_rdev&0377);
- /* check major & minor */
- if (status.st_rdev != makedev(ainfo->xmajor, ainfo->xminor)) {
- reperr(pkg_gt(ERR_MAJMIN), ainfo->xmajor,
- ainfo->xminor,
- (status.st_rdev>>8)&0377, status.st_rdev&0377);
- retcode = VE_CONT;
- }
-#else
if (setval || (ainfo->major == BADMAJOR))
ainfo->major = major(status.st_rdev);
if (setval || (ainfo->minor == BADMINOR))
@@ -746,7 +724,6 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
major(status.st_rdev), minor(status.st_rdev));
retcode = VE_CONT;
}
-#endif
}
/* compare specified mode w/ actual mode excluding sticky bit */
diff --git a/usr/src/lib/libpkg/common/vfpops.c b/usr/src/lib/libpkg/common/vfpops.c
index a4e6e54112..4c4b49c47c 100644
--- a/usr/src/lib/libpkg/common/vfpops.c
+++ b/usr/src/lib/libpkg/common/vfpops.c
@@ -911,7 +911,7 @@ vfpCheckpointFile(VFP_T **r_cpVfp, VFP_T **a_vfp, char *a_path)
/* copy contents of VFP to checkpoint to checkpointed VFP */
- memcpy(vfp, avfp, sizeof (VFP_T));
+ (void) memcpy(vfp, avfp, sizeof (VFP_T));
/* free contents of VFP to checkpoint */
diff --git a/usr/src/lib/libzonecfg/common/libzonecfg.c b/usr/src/lib/libzonecfg/common/libzonecfg.c
index 2e8251f82f..9a664b8824 100644
--- a/usr/src/lib/libzonecfg/common/libzonecfg.c
+++ b/usr/src/lib/libzonecfg/common/libzonecfg.c
@@ -92,7 +92,6 @@
#define DTD_ELEM_PSET (const xmlChar *) "pset"
#define DTD_ELEM_MCAP (const xmlChar *) "mcap"
#define DTD_ELEM_PACKAGE (const xmlChar *) "package"
-#define DTD_ELEM_PATCH (const xmlChar *) "patch"
#define DTD_ELEM_OBSOLETES (const xmlChar *) "obsoletes"
#define DTD_ELEM_DEV_PERM (const xmlChar *) "dev-perm"
#define DTD_ELEM_ADMIN (const xmlChar *) "admin"
@@ -561,8 +560,7 @@ strip_sw_inv(zone_dochandle_t handle)
next = child->next;
if (child->name == NULL)
continue;
- if (xmlStrcmp(child->name, DTD_ELEM_PACKAGE) == 0 ||
- xmlStrcmp(child->name, DTD_ELEM_PATCH) == 0) {
+ if (xmlStrcmp(child->name, DTD_ELEM_PACKAGE) == 0) {
next = child->next;
xmlUnlinkNode(child);
xmlFreeNode(child);
@@ -3497,36 +3495,6 @@ zonecfg_add_pkg(zone_dochandle_t handle, char *name, char *version)
return (Z_OK);
}
-int
-zonecfg_add_patch(zone_dochandle_t handle, char *id, void **pnode)
-{
- xmlNodePtr node = (xmlNodePtr)*pnode;
- xmlNodePtr cur;
- int err;
-
- if ((err = operation_prep(handle)) != Z_OK)
- return (err);
-
- cur = handle->zone_dh_cur;
- node = xmlNewTextChild(cur, NULL, DTD_ELEM_PATCH, NULL);
- if ((err = newprop(node, DTD_ATTR_ID, id)) != Z_OK)
- return (err);
- *pnode = (void *)node;
- return (Z_OK);
-}
-
-int
-zonecfg_add_patch_obs(char *id, void *cur)
-{
- xmlNodePtr node;
- int err;
-
- node = xmlNewTextChild((xmlNodePtr)cur, NULL, DTD_ELEM_OBSOLETES, NULL);
- if ((err = newprop(node, DTD_ATTR_ID, id)) != Z_OK)
- return (err);
- return (Z_OK);
-}
-
char *
zonecfg_strerror(int errnum)
{
@@ -6998,19 +6966,10 @@ zonecfg_getmcapent(zone_dochandle_t handle, struct zone_mcaptab *tabptr)
}
/*
- * Get the full tree of pkg/patch metadata in a set of nested AVL trees.
- * pkgs_avl is an AVL tree of pkgs. Each pkg element contains a
- * zpe_patches_avl member which holds an AVL tree of patches for that pkg.
- * The patch elements have the same zpe_patches_avl member, each of which can
- * hold an AVL tree of patches that are obsoleted by the patch.
+ * Get the full tree of pkg metadata in a set of nested AVL trees.
+ * pkgs_avl is an AVL tree of pkgs.
*
- * The zone xml data contains DTD_ELEM_PACKAGE elements, followed by
- * DTD_ELEM_PATCH elements. The DTD_ELEM_PATCH patch element applies to the
- * DTD_ELEM_PACKAGE that precedes it. The DTD_ELEM_PATCH element may have
- * child DTD_ELEM_OBSOLETES nodes associated with it. The DTD_ELEM_PACKAGE
- * really should have had the DTD_ELEM_PATCH elements as children but it
- * was not defined that way initially so we are stuck with the DTD definition
- * now. However, we can safely assume the ordering for compatibility.
+ * The zone xml data contains DTD_ELEM_PACKAGE elements.
*/
int
zonecfg_getpkgdata(zone_dochandle_t handle, uu_avl_pool_t *pkg_pool,
@@ -7064,8 +7023,6 @@ zonecfg_getpkgdata(zone_dochandle_t handle, uu_avl_pool_t *pkg_pool,
goto done;
}
- pkg->zpe_patches_avl = NULL;
-
uu_avl_node_init(pkg, &pkg->zpe_entry, pkg_pool);
if (uu_avl_find(pkgs_avl, pkg, NULL, &where) != NULL) {
free(pkg->zpe_name);
@@ -7074,131 +7031,6 @@ zonecfg_getpkgdata(zone_dochandle_t handle, uu_avl_pool_t *pkg_pool,
} else {
uu_avl_insert(pkgs_avl, pkg, where);
}
-
- } else if (xmlStrcmp(cur->name, DTD_ELEM_PATCH) == 0) {
- zone_pkg_entry_t *patch;
- uu_avl_index_t where;
- char *p;
- char *dashp = NULL;
- xmlNodePtr child;
-
- if ((res = fetchprop(cur, DTD_ATTR_ID, name,
- sizeof (name))) != Z_OK)
- goto done;
-
- if ((patch = (zone_pkg_entry_t *)
- malloc(sizeof (zone_pkg_entry_t))) == NULL) {
- res = Z_NOMEM;
- goto done;
- }
-
- if ((p = strchr(name, '-')) != NULL) {
- dashp = p;
- *p++ = '\0';
- } else {
- p = "";
- }
-
- if ((patch->zpe_name = strdup(name)) == NULL) {
- free(patch);
- res = Z_NOMEM;
- goto done;
- }
-
- if ((patch->zpe_vers = strdup(p)) == NULL) {
- free(patch->zpe_name);
- free(patch);
- res = Z_NOMEM;
- goto done;
- }
-
- if (dashp != NULL)
- *dashp = '-';
-
- patch->zpe_patches_avl = NULL;
-
- if (pkg->zpe_patches_avl == NULL) {
- pkg->zpe_patches_avl = uu_avl_create(pkg_pool,
- NULL, UU_DEFAULT);
- if (pkg->zpe_patches_avl == NULL) {
- free(patch->zpe_name);
- free(patch->zpe_vers);
- free(patch);
- res = Z_NOMEM;
- goto done;
- }
- }
-
- uu_avl_node_init(patch, &patch->zpe_entry, pkg_pool);
- if (uu_avl_find(pkg->zpe_patches_avl, patch, NULL,
- &where) != NULL) {
- free(patch->zpe_name);
- free(patch->zpe_vers);
- free(patch);
- } else {
- uu_avl_insert(pkg->zpe_patches_avl, patch,
- where);
- }
-
- /* Add any patches this patch obsoletes. */
- for (child = cur->xmlChildrenNode; child != NULL;
- child = child->next) {
- zone_pkg_entry_t *obs;
-
- if (xmlStrcmp(child->name, DTD_ELEM_OBSOLETES)
- != 0)
- continue;
-
- if ((res = fetchprop(child, DTD_ATTR_ID,
- name, sizeof (name))) != Z_OK)
- goto done;
-
- if ((obs = (zone_pkg_entry_t *)malloc(
- sizeof (zone_pkg_entry_t))) == NULL) {
- res = Z_NOMEM;
- goto done;
- }
-
- if ((obs->zpe_name = strdup(name)) == NULL) {
- free(obs);
- res = Z_NOMEM;
- goto done;
- }
- /*
- * The version doesn't matter for obsoleted
- * patches.
- */
- obs->zpe_vers = NULL;
- obs->zpe_patches_avl = NULL;
-
- /*
- * If this is the first obsolete patch, add an
- * AVL tree to the parent patch element.
- */
- if (patch->zpe_patches_avl == NULL) {
- patch->zpe_patches_avl =
- uu_avl_create(pkg_pool, NULL,
- UU_DEFAULT);
- if (patch->zpe_patches_avl == NULL) {
- free(obs->zpe_name);
- free(obs);
- res = Z_NOMEM;
- goto done;
- }
- }
-
- /* Insert obsolete patch into the AVL tree. */
- uu_avl_node_init(obs, &obs->zpe_entry,
- pkg_pool);
- if (uu_avl_find(patch->zpe_patches_avl, obs,
- NULL, &where) != NULL) {
- free(obs->zpe_name);
- free(obs);
- } else {
- uu_avl_insert(patch->zpe_patches_avl,
- obs, where);
- }
- }
}
}
diff --git a/usr/src/lib/libzonecfg/common/mapfile-vers b/usr/src/lib/libzonecfg/common/mapfile-vers
index 98723f8e21..b908a28174 100644
--- a/usr/src/lib/libzonecfg/common/mapfile-vers
+++ b/usr/src/lib/libzonecfg/common/mapfile-vers
@@ -53,8 +53,6 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zonecfg_add_fs_option;
zonecfg_add_admin;
zonecfg_add_nwif;
- zonecfg_add_patch;
- zonecfg_add_patch_obs;
zonecfg_add_pkg;
zonecfg_add_pset;
zonecfg_add_rctl;