summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-01-26 17:26:32 +0200
committerToomas Soome <tsoome@me.com>2019-07-31 08:07:59 +0300
commitc57b775050136774ef88b195e5833b3f9b86561b (patch)
tree34dd92698c50d1cbdbe5f07e36b0fc29edf0c5aa
parent741b4d05bd52eb10a07f4f147bd8a211e5fe4351 (diff)
downloadillumos-joyent-c57b775050136774ef88b195e5833b3f9b86561b.tar.gz
11435 svr4pkg: NULL pointer errors
Reviewed by: Andy Fiddaman <andy@omniosce.org> Reviewed by: Peter Tribble <peter.tribble@gmail.com> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/cmd/svr4pkg/libinst/fixpath.c2
-rw-r--r--usr/src/cmd/svr4pkg/libinst/isreloc.c6
-rw-r--r--usr/src/cmd/svr4pkg/libinst/mntinfo.c4
-rw-r--r--usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c4
-rw-r--r--usr/src/cmd/svr4pkg/libinst/pkgobjmap.c2
-rw-r--r--usr/src/cmd/svr4pkg/libinst/scriptvfy.l2
-rw-r--r--usr/src/cmd/svr4pkg/pkgchk/checkmap.c2
-rw-r--r--usr/src/cmd/svr4pkg/pkgchk/ckentry.c4
-rw-r--r--usr/src/cmd/svr4pkg/pkginfo/pkginfo.c14
-rw-r--r--usr/src/cmd/svr4pkg/pkginstall/getinst.c6
-rw-r--r--usr/src/cmd/svr4pkg/pkginstall/quit.c4
-rw-r--r--usr/src/cmd/svr4pkg/pkgmk/main.c2
-rw-r--r--usr/src/cmd/svr4pkg/pkgmk/mkpkgmap.c2
-rw-r--r--usr/src/cmd/svr4pkg/pkgremove/check.c8
-rw-r--r--usr/src/cmd/svr4pkg/pkgserv/pkgserv.c4
15 files changed, 33 insertions, 33 deletions
diff --git a/usr/src/cmd/svr4pkg/libinst/fixpath.c b/usr/src/cmd/svr4pkg/libinst/fixpath.c
index 7ed5961b81..9eccb948f9 100644
--- a/usr/src/cmd/svr4pkg/libinst/fixpath.c
+++ b/usr/src/cmd/svr4pkg/libinst/fixpath.c
@@ -316,7 +316,7 @@ orig_path_ptr(char *path)
*/
else if (strncmp(path, install_root, install_root_len) == 0) {
retv = path + install_root_len;
- if (*retv == NULL)
+ if (*retv == '\0')
retv = "/";
/*
diff --git a/usr/src/cmd/svr4pkg/libinst/isreloc.c b/usr/src/cmd/svr4pkg/libinst/isreloc.c
index 73bed3160b..58f8ca897d 100644
--- a/usr/src/cmd/svr4pkg/libinst/isreloc.c
+++ b/usr/src/cmd/svr4pkg/libinst/isreloc.c
@@ -137,7 +137,7 @@ has_rel_path(char *entry)
register int entry_pos = 1;
/* If the line is a comment or special directive, return 0 */
- if (*entry == NULL || strchr(IGNORE_START, *entry))
+ if (*entry == '\0' || strchr(IGNORE_START, *entry) != NULL)
return (0);
/* Skip past this data entry if it is volume number. */
@@ -158,7 +158,7 @@ has_rel_path(char *entry)
* or the type indicates this line should be ignored, we return
* as though not relative.
*/
- if (*entry == NULL || strchr(IGNORE_TYPE, *entry))
+ if (*entry == '\0' || strchr(IGNORE_TYPE, *entry))
return (0);
/* The pathname is in the third position */
@@ -172,7 +172,7 @@ has_rel_path(char *entry)
while (*entry && isspace(*entry)) {
entry++;
}
- } while (++entry_pos < 3 && *entry != NULL);
+ } while (++entry_pos < 3 && *entry != '\0');
/*
* Now we're pointing at the first character of the pathname.
diff --git a/usr/src/cmd/svr4pkg/libinst/mntinfo.c b/usr/src/cmd/svr4pkg/libinst/mntinfo.c
index 086762899c..7090568a65 100644
--- a/usr/src/cmd/svr4pkg/libinst/mntinfo.c
+++ b/usr/src/cmd/svr4pkg/libinst/mntinfo.c
@@ -223,7 +223,7 @@ get_server_host(uint32_t n)
if (n < fs_tab_used) {
(void) strcpy(hostname, fs_tab[n]->remote_name);
if ((host_end = strchr(hostname, ':')) == NULL) {
- if ((strcmp(fs_tab[n]->fstype, MNTTYPE_AUTOFS)) == NULL)
+ if ((strcmp(fs_tab[n]->fstype, MNTTYPE_AUTOFS)) == 0)
return ("automounter");
else
return (fs_tab[n]->fstype);
@@ -1121,7 +1121,7 @@ fsys(char *path)
* do the string compare. -- JST
*/
if ((fs_namelen == 1 && *(fs_tab[i]->name) == '/') ||
- ((term_char == '/' || term_char == NULL) &&
+ ((term_char == '/' || term_char == '\0') &&
strncmp(fs_tab[i]->name, path2use, fs_namelen) == 0)) {
return (i);
}
diff --git a/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c b/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c
index ef1bdb07e1..5418cd9209 100644
--- a/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c
+++ b/usr/src/cmd/svr4pkg/libinst/pkgdbmerg.c
@@ -930,7 +930,7 @@ merg(struct cfextra *el_ent, struct cfent *cf_ent)
* already done.
*/
if (strcmp(cf_ent->ainfo.local,
- el_ent->cf_ent.ainfo.local) != NULL) {
+ el_ent->cf_ent.ainfo.local) != 0) {
changed++;
/*
@@ -939,7 +939,7 @@ merg(struct cfextra *el_ent, struct cfent *cf_ent)
* entry.
*/
if (strcmp(el_ent->cf_ent.ainfo.local,
- "?") == NULL) {
+ "?") == 0) {
(void) strlcpy(
el_ent->cf_ent.ainfo.local,
cf_ent->ainfo.local,
diff --git a/usr/src/cmd/svr4pkg/libinst/pkgobjmap.c b/usr/src/cmd/svr4pkg/libinst/pkgobjmap.c
index 13a041418c..9d4a05d116 100644
--- a/usr/src/cmd/svr4pkg/libinst/pkgobjmap.c
+++ b/usr/src/cmd/svr4pkg/libinst/pkgobjmap.c
@@ -227,7 +227,7 @@ seed_pkgobjmap(struct cfextra *ext_entry, char *path, char *local)
if (ext_ptr == NULL || *ext_ptr == NULL) {
progerr(gettext(ERR_MEMORY));
- return (NULL);
+ return (0);
}
ext = *ext_ptr;
diff --git a/usr/src/cmd/svr4pkg/libinst/scriptvfy.l b/usr/src/cmd/svr4pkg/libinst/scriptvfy.l
index f467b840cc..68c2e8d009 100644
--- a/usr/src/cmd/svr4pkg/libinst/scriptvfy.l
+++ b/usr/src/cmd/svr4pkg/libinst/scriptvfy.l
@@ -626,7 +626,7 @@ scripteval(char *script_name, char *script_path, int mask, int silent)
int error = 0;
line_no = 1;
- if ((script_path == NULL) || (*script_path == NULL) ||
+ if ((script_path == NULL) || (*script_path == '\0') ||
(script_name == NULL)) {
logerr(gettext(ERR_ARGS));
return (0);
diff --git a/usr/src/cmd/svr4pkg/pkgchk/checkmap.c b/usr/src/cmd/svr4pkg/pkgchk/checkmap.c
index 9bfcd3c620..fff5c2a93d 100644
--- a/usr/src/cmd/svr4pkg/pkgchk/checkmap.c
+++ b/usr/src/cmd/svr4pkg/pkgchk/checkmap.c
@@ -326,7 +326,7 @@ selpkg(char *p)
}
} else {
for (i = 0; i < pkgcnt; ++i) {
- if (selected[i] == NULL) {
+ if (selected[i] == '\0') {
root = get_inst_root();
if (root)
(void) snprintf(buf,
diff --git a/usr/src/cmd/svr4pkg/pkgchk/ckentry.c b/usr/src/cmd/svr4pkg/pkgchk/ckentry.c
index ab470ac8fc..6c1595010b 100644
--- a/usr/src/cmd/svr4pkg/pkgchk/ckentry.c
+++ b/usr/src/cmd/svr4pkg/pkgchk/ckentry.c
@@ -224,8 +224,8 @@ xdir(int maptyp, VFP_T *vfp, PKGserver server, char *dirname)
errflg = 0;
(void) memset((char *)&mine, '\0', sizeof (struct cfent));
while ((drp = readdir(dirfp)) != NULL) {
- if (strcmp(drp->d_name, ".") == NULL ||
- strcmp(drp->d_name, "..") == NULL)
+ if (strcmp(drp->d_name, ".") == 0 ||
+ strcmp(drp->d_name, "..") == 0)
continue;
(void) snprintf(badpath, sizeof (badpath), "%s/%s",
dirname, drp->d_name);
diff --git a/usr/src/cmd/svr4pkg/pkginfo/pkginfo.c b/usr/src/cmd/svr4pkg/pkginfo/pkginfo.c
index cdb0397015..4e97dd8ef3 100644
--- a/usr/src/cmd/svr4pkg/pkginfo/pkginfo.c
+++ b/usr/src/cmd/svr4pkg/pkginfo/pkginfo.c
@@ -279,7 +279,7 @@ main(int argc, char **argv)
pkg = &argv[optind];
pkgcnt = (argc - optind);
- if (pkg[0] && strcmp(pkg[0], "all") == NULL) {
+ if (pkg[0] && strcmp(pkg[0], "all") == 0) {
pkgcnt = 0;
pkg[0] = NULL;
}
@@ -358,10 +358,10 @@ report(void)
* Confirm that the pkginfo file contains the
* required information.
*/
- if (info.name == NULL || *(info.name) == NULL ||
- info.arch == NULL || *(info.arch) == NULL ||
- info.version == NULL || *(info.version) == NULL ||
- info.catg == NULL || *(info.catg) == NULL) {
+ if (info.name == NULL || *(info.name) == '\0' ||
+ info.arch == NULL || *(info.arch) == '\0' ||
+ info.version == NULL || *(info.version) == '\0' ||
+ info.catg == NULL || *(info.catg) == '\0') {
progerr(gettext(ERR_BADINFO));
errflg++;
return;
@@ -542,9 +542,9 @@ fpkg(char *pkginst)
struct cfstat *dp, *last;
dp = data;
- last = (struct cfstat *)0;
+ last = NULL;
while (dp) {
- if (strcmp(dp->pkginst, pkginst) == NULL)
+ if (strcmp(dp->pkginst, pkginst) == 0)
return (dp);
last = dp;
dp = dp->next;
diff --git a/usr/src/cmd/svr4pkg/pkginstall/getinst.c b/usr/src/cmd/svr4pkg/pkginstall/getinst.c
index 1e4bbfec71..d0ba4a610c 100644
--- a/usr/src/cmd/svr4pkg/pkginstall/getinst.c
+++ b/usr/src/cmd/svr4pkg/pkginstall/getinst.c
@@ -110,10 +110,10 @@ getinst(int *updatingExisting, struct pkginfo *info, int npkgs,
samearch = nsamearch = 0;
sameinst = NULL;
for (i = 0; i < npkgs; i++) {
- if (strcmp(info[i].arch, pkgarch) == NULL) {
+ if (strcmp(info[i].arch, pkgarch) == 0) {
samearch = i;
nsamearch++;
- if (strcmp(info[i].version, pkgvers) == NULL) {
+ if (strcmp(info[i].version, pkgvers) == 0) {
sameinst = info[i].pkginst;
}
}
@@ -189,7 +189,7 @@ getinst(int *updatingExisting, struct pkginfo *info, int npkgs,
}
inst = prompt(info, npkgs);
- if (strcmp(inst, "new") == NULL) {
+ if (strcmp(inst, "new") == 0) {
inst = nextinst();
return (inst);
}
diff --git a/usr/src/cmd/svr4pkg/pkginstall/quit.c b/usr/src/cmd/svr4pkg/pkginstall/quit.c
index 664de95126..6abb2b3087 100644
--- a/usr/src/cmd/svr4pkg/pkginstall/quit.c
+++ b/usr/src/cmd/svr4pkg/pkginstall/quit.c
@@ -289,12 +289,12 @@ quit(int retcode)
ptext(stderr, MSG_DRYRUN_DONE);
ptext(stderr, MSG_NOCHANGE);
- if (tmpdir[0] != NULL)
+ if (tmpdir[0] != '\0')
(void) rrmdir(tmpdir);
} else {
/* fix bug #1082589 that deletes root file */
- if (tmpdir[0] != NULL) {
+ if (tmpdir[0] != '\0') {
(void) rrmdir(tmpdir);
}
diff --git a/usr/src/cmd/svr4pkg/pkgmk/main.c b/usr/src/cmd/svr4pkg/pkgmk/main.c
index 64fac814d5..bfe1c43a42 100644
--- a/usr/src/cmd/svr4pkg/pkgmk/main.c
+++ b/usr/src/cmd/svr4pkg/pkgmk/main.c
@@ -427,7 +427,7 @@ main(int argc, char *argv[])
/* add command line variables */
while (*cmdparam && (value = strchr(*cmdparam, '=')) != NULL) {
- *value = NULL; /* terminate the parameter */
+ *value = '\0'; /* terminate the parameter */
value++; /* value is now the value (not '=') */
putparam(*cmdparam++, value); /* store it in environ */
}
diff --git a/usr/src/cmd/svr4pkg/pkgmk/mkpkgmap.c b/usr/src/cmd/svr4pkg/pkgmk/mkpkgmap.c
index a0c327fb0c..fa5a311165 100644
--- a/usr/src/cmd/svr4pkg/pkgmk/mkpkgmap.c
+++ b/usr/src/cmd/svr4pkg/pkgmk/mkpkgmap.c
@@ -600,7 +600,7 @@ doinclude(void)
translate(file, temp);
canonize(temp);
- if (*temp == NULL)
+ if (*temp == '\0')
return;
else if (*temp != '/')
(void) snprintf(file, sizeof (file), "%s/%s", dname[nfp], temp);
diff --git a/usr/src/cmd/svr4pkg/pkgremove/check.c b/usr/src/cmd/svr4pkg/pkgremove/check.c
index 6cf5b4350b..b5fc8e5470 100644
--- a/usr/src/cmd/svr4pkg/pkgremove/check.c
+++ b/usr/src/cmd/svr4pkg/pkgremove/check.c
@@ -100,7 +100,7 @@ rckrunlevel(void)
if ((pt = strtok(pt, " \t\n, ")) == NULL)
return (0); /* no list is no list */
do {
- if (strcmp(pt, uxstate) == NULL) {
+ if (strcmp(pt, uxstate) == 0) {
free(rstates);
return (0);
}
@@ -220,9 +220,9 @@ rckpriv(void)
found = 0;
while ((dp = readdir(dirfp)) != NULL) {
- if ((strcmp(dp->d_name, "preremove") == NULL) ||
- (strcmp(dp->d_name, "postremove") == NULL) ||
- (strncmp(dp->d_name, "r.", 2) == NULL)) {
+ if ((strcmp(dp->d_name, "preremove") == 0) ||
+ (strcmp(dp->d_name, "postremove") == 0) ||
+ (strncmp(dp->d_name, "r.", 2) == 0)) {
found++;
break;
}
diff --git a/usr/src/cmd/svr4pkg/pkgserv/pkgserv.c b/usr/src/cmd/svr4pkg/pkgserv/pkgserv.c
index 44cfb52972..2841f24b6d 100644
--- a/usr/src/cmd/svr4pkg/pkgserv/pkgserv.c
+++ b/usr/src/cmd/svr4pkg/pkgserv/pkgserv.c
@@ -580,7 +580,7 @@ pkg_door_srv(void *cookie, char *argp, size_t asz, door_desc_t *dp,
err:
(void) mutex_unlock(&mtx);
- (void) door_return((void *)&one, 4, NULL, NULL);
+ (void) door_return((void *)&one, 4, NULL, 0);
}
/*
@@ -1263,7 +1263,7 @@ pkgfilter(pkgfilter_t *pf, door_desc_t *dp)
/* Copy the file descriptor in the command field */
cpf->cmd = p[1];
- if (thr_create(NULL, NULL, thr_pkgfilter, cpf, THR_DETACHED,
+ if (thr_create(NULL, 0, thr_pkgfilter, cpf, THR_DETACHED,
&tid) != 0) {
(void) close(p[0]);
(void) close(p[1]);