summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr/src/lib/libpkg/common/devtype.c4
-rw-r--r--usr/src/lib/libpkg/common/dstream.c18
-rw-r--r--usr/src/lib/libpkg/common/mappath.c2
-rw-r--r--usr/src/lib/libpkg/common/pkgtrans.c21
-rw-r--r--usr/src/lib/libpkg/common/runcmd.c29
-rw-r--r--usr/src/lib/libpkg/common/verify.c48
6 files changed, 59 insertions, 63 deletions
diff --git a/usr/src/lib/libpkg/common/devtype.c b/usr/src/lib/libpkg/common/devtype.c
index e087966f86..318e4507bc 100644
--- a/usr/src/lib/libpkg/common/devtype.c
+++ b/usr/src/lib/libpkg/common/devtype.c
@@ -36,7 +36,7 @@
#include "pkgdev.h"
#include "pkglib.h"
-extern char *devattr(char *device, char *attribute); /* libadm.a */
+extern char *devattr(char *device, char *attribute); /* libadm.a */
int
devtype(char *alias, struct pkgdev *devp)
@@ -59,7 +59,7 @@ devtype(char *alias, struct pkgdev *devp)
/* see if alias represents a mountable device (e.g., a floppy) */
if ((devp->mount = devattr(alias, "mountpt")) != NULL &&
- devp->mount[0] != NULL) {
+ devp->mount[0] != '\0') {
devp->bdevice = devattr(alias, "bdevice");
if (!devp->bdevice || !devp->bdevice[0]) {
if (devp->bdevice) {
diff --git a/usr/src/lib/libpkg/common/dstream.c b/usr/src/lib/libpkg/common/dstream.c
index 6622b74361..d2844d877b 100644
--- a/usr/src/lib/libpkg/common/dstream.c
+++ b/usr/src/lib/libpkg/common/dstream.c
@@ -91,7 +91,7 @@ struct dstoc {
#define ds_nparts ds_toc->nparts
#define ds_maxsiz ds_toc->maxsiz
-int ds_totread; /* total number of parts read */
+int ds_totread; /* total number of parts read */
int ds_fd = -1;
int ds_curpartcnt = -1;
@@ -100,16 +100,16 @@ int ds_ginit(char *device);
int ds_close(int pkgendflg);
static FILE *ds_pp;
-static int ds_realfd = -1; /* file descriptor for real device */
-static int ds_read; /* number of parts read for current package */
-static int ds_volno; /* volume number of current volume */
-static int ds_volcnt; /* total number of volumes */
-static char ds_volnos[128]; /* parts/volume info */
+static int ds_realfd = -1; /* file descriptor for real device */
+static int ds_read; /* number of parts read for current package */
+static int ds_volno; /* volume number of current volume */
+static int ds_volcnt; /* total number of volumes */
+static char ds_volnos[128]; /* parts/volume info */
static char *ds_device;
static int ds_volpart; /* number of parts read in current volume, */
/* including skipped parts */
static int ds_bufsize;
-static int ds_skippart; /* number of parts skipped in current volume */
+static int ds_skippart; /* number of parts skipped in current volume */
static int ds_getnextvol(char *device);
static int ds_skip(char *device, int nskip);
@@ -299,7 +299,7 @@ ds_init(char *device, char **pkg, char *norewind)
char line[LSIZE+1];
int i, n, count = 0, header_size = BLK_SIZE;
- if (!ds_header) { /* If the header hasn't been read yet */
+ if (!ds_header) { /* If the header hasn't been read yet */
if (ds_fd >= 0)
(void) ds_close(0);
@@ -608,7 +608,7 @@ ds_getnextvol(char *device)
(void) sprintf(prompt,
pkg_gt("Insert %%v %d of %d into %%p"),
ds_volno, ds_volcnt);
- if (n = getvol(device, NULL, NULL, prompt))
+ if (n = getvol(device, NULL, 0, prompt))
return (n);
if ((ds_fd = open(device, O_RDONLY)) < 0)
return (-1);
diff --git a/usr/src/lib/libpkg/common/mappath.c b/usr/src/lib/libpkg/common/mappath.c
index b0ae99d827..f885f81ebf 100644
--- a/usr/src/lib/libpkg/common/mappath.c
+++ b/usr/src/lib/libpkg/common/mappath.c
@@ -93,7 +93,7 @@ mappath(int flag, char *path)
* error.
*/
if ((token = getenv(varname)) != NULL &&
- *token != NULL) {
+ *token != '\0') {
/* copy in parameter value */
while (*token)
*copy++ = *token++;
diff --git a/usr/src/lib/libpkg/common/pkgtrans.c b/usr/src/lib/libpkg/common/pkgtrans.c
index cfc4009b08..e3f6276bf3 100644
--- a/usr/src/lib/libpkg/common/pkgtrans.c
+++ b/usr/src/lib/libpkg/common/pkgtrans.c
@@ -59,7 +59,7 @@
#include "pkglibmsgs.h"
#include "pkglocale.h"
-extern char *pkgdir; /* pkgparam.c */
+extern char *pkgdir; /* pkgparam.c */
/* libadm.a */
extern char *devattr(char *device, char *attribute);
@@ -95,7 +95,7 @@ static char *tmpdir;
static char *tmppath;
static char *tmpsymdir = NULL;
static char dstinst[NON_ABI_NAMELNGTH];
-static char *ids_name, *ods_name;
+static char *ids_name, *ods_name;
static int ds_volcnt;
static int ds_volno;
static int compressedsize, has_comp_size;
@@ -133,7 +133,7 @@ static char *reloc_names[] = {
static int signal_received = 0;
-char **xpkg; /* array of transferred packages */
+char **xpkg; /* array of transferred packages */
int nxpkg;
static char *allpkg[] = {
@@ -253,7 +253,7 @@ _pkgtrans(char *device1, char *device2, char **pkg, int options)
/* check for datastream */
ids_name = NULL;
if (srcdev.bdevice) {
- if (n = _getvol(srcdev.bdevice, NULL, NULL,
+ if (n = _getvol(srcdev.bdevice, NULL, 0,
pkg_gt("Insert %v into %p."), srcdev.norewind)) {
cleanup();
if (n == 3)
@@ -354,7 +354,7 @@ _pkgtrans(char *device1, char *device2, char **pkg, int options)
if (ids_name) {
if (srcdev.cdevice && !srcdev.bdevice &&
- (n = _getvol(srcdev.cdevice, NULL, NULL, NULL,
+ (n = _getvol(srcdev.cdevice, NULL, 0, NULL,
srcdev.norewind))) {
cleanup();
if (n == 3)
@@ -709,7 +709,7 @@ genheader(char *src, char **pkg)
/* add pkg name, number of parts and the max part size */
if (snprintf(tmp_entry, ENTRY_MAX, "%s %d %d",
- pkg[i], nparts, maxpsize) >= ENTRY_MAX) {
+ pkg[i], nparts, maxpsize) >= ENTRY_MAX) {
progerr(pkg_gt(ERR_TRANSFER));
logerr(pkg_gt(ERR_MEM));
(void) fclose(fp);
@@ -811,7 +811,7 @@ wdsheader(struct dm_buf *hdr, char *device, char **pkg)
* of each 512 bytes.
*/
for (block_cnt = 0; block_cnt < hdr->allocation;
- block_cnt += BLK_SIZE) {
+ block_cnt += BLK_SIZE) {
(void) write(ds_fd, (hdr->text_buffer + block_cnt), BLK_SIZE);
}
@@ -897,11 +897,8 @@ pkgxfer(char *srcinst, int options)
struct pkginfo info;
FILE *fp, *pp;
char *pt, *src, *dst;
- char dstdir[PATH_MAX],
- temp[PATH_MAX],
- srcdir[PATH_MAX],
- cmd[CMDSIZE],
- pkgname[NON_ABI_NAMELNGTH];
+ char dstdir[PATH_MAX], temp[PATH_MAX], srcdir[PATH_MAX];
+ char cmd[CMDSIZE], pkgname[NON_ABI_NAMELNGTH];
int i, n, part, nparts, maxpartsize, curpartcnt, iscomp;
char volnos[128], tmpvol[128];
struct statvfs64 svfsb;
diff --git a/usr/src/lib/libpkg/common/runcmd.c b/usr/src/lib/libpkg/common/runcmd.c
index 3be8d36ee2..758753498b 100644
--- a/usr/src/lib/libpkg/common/runcmd.c
+++ b/usr/src/lib/libpkg/common/runcmd.c
@@ -88,7 +88,7 @@ ecleanup(void)
{
if (errfile[0]) {
(void) unlink(errfile);
- errfile[0] = NULL;
+ errfile[0] = '\0';
}
}
@@ -218,15 +218,15 @@ epopen(char *cmd, char *mode)
if (strlcpy(errfile, perrfile, sizeof (errfile)) > sizeof (errfile)) {
progerr(pkg_gt("file name max length %d; name is too long: %s"),
- sizeof (errfile), perrfile);
- return ((FILE *)0);
+ sizeof (errfile), perrfile);
+ return (NULL);
}
len = strlen(cmd)+6+strlen(errfile);
buffer = (char *)calloc(len, sizeof (char));
if (buffer == NULL) {
progerr(pkg_gt("no memory in epopen(), errno=%d"), errno);
- return ((FILE *)0);
+ return (NULL);
}
if (strchr(cmd, '|')) {
@@ -237,8 +237,8 @@ epopen(char *cmd, char *mode)
if (alen > len) {
progerr(pkg_gt("command max length %d; cmd is too long: %s"),
- len, cmd);
- return ((FILE *)0);
+ len, cmd);
+ return (NULL);
}
pp = popen(buffer, mode);
@@ -289,7 +289,7 @@ epclose(FILE *pp)
* r_status and r_results have no meaning;
* r_status will be -1
* r_results will be NULL
- * NOTE: Any results returned is placed in new storage for the
+ * NOTE: Any results returned is placed in new storage for the
* calling method. The caller must use 'free' to dispose
* of the storage once the results are no longer needed.
* NOTE: If 0 is returned, 'r_status' must be queried to
@@ -301,7 +301,7 @@ epclose(FILE *pp)
int
e_ExecCmdArray(int *r_status, char **r_results,
- char *a_inputFile, char *a_cmd, char **a_args)
+ char *a_inputFile, char *a_cmd, char **a_args)
{
char *buffer;
int bufferIndex;
@@ -427,7 +427,7 @@ e_ExecCmdArray(int *r_status, char **r_results,
/* read as much child data as there is available buffer space */
bytesRead = read(ipipe[0], buffer + bufferIndex,
- bufferSize - bufferIndex);
+ bufferSize - bufferIndex);
/* break out of read loop if end-of-file encountered */
@@ -459,9 +459,9 @@ e_ExecCmdArray(int *r_status, char **r_results,
bufferIndex += bytesRead;
if (bufferIndex >= bufferSize) {
buffer = realloc(buffer,
- bufferSize += PIPE_BUFFER_INCREMENT);
+ bufferSize += PIPE_BUFFER_INCREMENT);
(void) memset(buffer + bufferIndex, 0,
- bufferSize - bufferIndex);
+ bufferSize - bufferIndex);
}
}
@@ -538,7 +538,7 @@ e_ExecCmdArray(int *r_status, char **r_results,
* Look at r_status for results of Unix command
* != 0 - problems executing command
* r_status and r_results have no meaning
- * NOTE: Any results returned is placed in new storage for the
+ * NOTE: Any results returned is placed in new storage for the
* calling method. The caller must use 'free' to dispose
* of the storage once the results are no longer needed.
* NOTE: If LU_SUCCESS is returned, 'r_status' must be queried to
@@ -547,7 +547,7 @@ e_ExecCmdArray(int *r_status, char **r_results,
int
e_ExecCmdList(int *r_status, char **r_results,
- char *a_inputFile, char *a_cmd, ...)
+ char *a_inputFile, char *a_cmd, ...)
{
va_list ap; /* references variable argument list */
char *array[MAX_EXEC_CMD_ARGS+1];
@@ -569,6 +569,5 @@ e_ExecCmdList(int *r_status, char **r_results,
}
va_end(ap);
- return (e_ExecCmdArray(r_status, r_results, a_inputFile,
- a_cmd, array));
+ return (e_ExecCmdArray(r_status, r_results, a_inputFile, a_cmd, array));
}
diff --git a/usr/src/lib/libpkg/common/verify.c b/usr/src/lib/libpkg/common/verify.c
index 3329d9aff2..0217636e70 100644
--- a/usr/src/lib/libpkg/common/verify.c
+++ b/usr/src/lib/libpkg/common/verify.c
@@ -142,9 +142,9 @@ reperr(char *fmt, ...)
int
cverify(int fix, char *ftype, char *path, struct cinfo *cinfo,
- int allow_checksum)
+ int allow_checksum)
{
- struct stat status; /* file status buffer */
+ struct stat status; /* file status buffer */
struct utimbuf times;
unsigned long mycksum;
int setval, retcode;
@@ -179,11 +179,11 @@ cverify(int fix, char *ftype, char *path, struct cinfo *cinfo,
} else if (fix < 0) {
/* modtimes must be the same */
if (strftime(tbuf1, sizeof (tbuf1), DATEFMT,
- localtime(&cinfo->modtime)) == 0) {
+ localtime(&cinfo->modtime)) == 0) {
reperr(pkg_gt(ERR_MEM));
}
if (strftime(tbuf2, sizeof (tbuf2), DATEFMT,
- localtime(&status.st_mtime)) == 0) {
+ localtime(&status.st_mtime)) == 0) {
reperr(pkg_gt(ERR_MEM));
}
reperr(pkg_gt(ERR_MTIME), tbuf1, tbuf2);
@@ -295,7 +295,7 @@ compute_checksum(int *r_cksumerr, char *a_path)
*/
errno = 0;
while ((nread = read(fd, (void*)buf,
- (sbuf.st_size < CHUNK) ? sbuf.st_size : CHUNK)) > 0) {
+ (sbuf.st_size < CHUNK) ? sbuf.st_size : CHUNK)) > 0) {
uchar_t *s;
uint32_t *p = buf;
@@ -328,8 +328,8 @@ compute_checksum(int *r_cksumerr, char *a_path)
return (lsavhi+lsavlo);
}
-static struct stat status; /* file status buffer */
-static struct statvfs vfsstatus; /* filesystem status buffer */
+static struct stat status; /* file status buffer */
+static struct statvfs vfsstatus; /* filesystem status buffer */
/*
* Remove the thing that's currently in place so we can put down the package
@@ -384,7 +384,7 @@ clear_target(char *path, char *ftype, int is_a_dir)
int
averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
{
- struct group *grp; /* group entry buffer */
+ struct group *grp; /* group entry buffer */
struct passwd *pwd;
int n;
int setval;
@@ -397,9 +397,9 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
char buf[PATH_MAX];
ino_t my_ino;
dev_t my_dev;
- char cwd[MAXPATHLEN];
- char *cd;
- char *c;
+ char cwd[MAXPATHLEN];
+ char *cd;
+ char *c;
setval = (*ftype == '?');
retcode = 0;
@@ -435,7 +435,7 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
if (strcmp(cd, c) == 0)
(void) strcpy(cd, "/");
else
- *c = NULL;
+ *c = '\0';
if (chdir(cd) != 0) {
reperr(pkg_gt(ERR_CHDIR), cd);
@@ -493,7 +493,7 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
/* If we are to process symlinks the old way then we follow the link */
if (nonABI_symlinks()) {
if ((*ftype == 's') ? lstat(path, &status) :
- stat(path, &status)) {
+ stat(path, &status)) {
reperr(pkg_gt(ERR_EXIST));
retcode = VE_EXIST;
myftype = '?';
@@ -511,37 +511,37 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
if (!statError) {
/* determining actual type of existing object */
switch (status.st_mode & S_IFMT) {
- case S_IFLNK:
+ case S_IFLNK:
myftype = 's';
break;
- case S_IFIFO:
+ case S_IFIFO:
myftype = 'p';
break;
- case S_IFCHR:
+ case S_IFCHR:
myftype = 'c';
break;
- case S_IFDIR:
+ case S_IFDIR:
myftype = 'd';
targ_is_dir = 1;
break;
- case S_IFBLK:
+ case S_IFBLK:
myftype = 'b';
break;
- case S_IFREG:
- case 0:
+ case S_IFREG:
+ case 0:
myftype = 'f';
break;
- case S_IFDOOR:
+ case S_IFDOOR:
myftype = 'D';
break;
- default:
+ default:
reperr(pkg_gt(ERR_UNKNOWN));
return (VE_FTYPE);
}
@@ -695,7 +695,7 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
return (VE_FAIL);
}
} else if (*ftype == 'p') {
- if (mknod(path, ainfo->mode | S_IFIFO, NULL) ||
+ if (mknod(path, ainfo->mode | S_IFIFO, 0) ||
(stat(path, &status) < 0)) {
reperr(pkg_gt(ERR_PIPEFAIL));
return (VE_FAIL);
@@ -736,7 +736,7 @@ averify(int fix, char *ftype, char *path, struct ainfo *ainfo)
retcode = VE_FAIL;
} else {
reperr(pkg_gt(ERR_PERM), ainfo->mode,
- status.st_mode & 07777);
+ status.st_mode & 07777);
if (!retcode)
retcode = VE_ATTR;
}