diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ps/keyword.c | 4 | ||||
-rw-r--r-- | bin/ps/print.c | 4 | ||||
-rw-r--r-- | bin/ps/ps.c | 10 |
3 files changed, 8 insertions, 10 deletions
diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index f5724e0..8616757 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -247,10 +247,10 @@ parsefmt(const char *p) if (cp == NULL || !(v = findvar(cp))) continue; if ((vent = malloc(sizeof(struct varent))) == NULL) - err(1, NULL); + errx(1, "malloc failed"); vent->var = malloc(sizeof(*vent->var)); if (vent->var == NULL) - err(1, NULL); + errx(1, "malloc failed"); memcpy(vent->var, v, sizeof(*vent->var)); vent->next = NULL; if (vhead == NULL) diff --git a/bin/ps/print.c b/bin/ps/print.c index fefb005..f885770 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -108,11 +108,11 @@ command(KINFO *k, VARENT *ve) } if ((vis_args = malloc(strlen(k->ki_args) * 4 + 1)) == NULL) - err(1, NULL); + errx(1, "malloc failed"); strvis(vis_args, k->ki_args, VIS_TAB | VIS_NL | VIS_NOSLASH); if (k->ki_env) { if ((vis_env = malloc(strlen(k->ki_env) * 4 + 1)) == NULL) - err(1, NULL); + errx(1, "malloc failed"); strvis(vis_env, k->ki_env, VIS_TAB | VIS_NL | VIS_NOSLASH); } else vis_env = NULL; diff --git a/bin/ps/ps.c b/bin/ps/ps.c index c6da58e..2a25c92 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -311,7 +311,7 @@ main(int argc, char *argv[]) /* XXX - should be cleaner */ if (!all && ttydev == NODEV && pid == -1 && !nuids) { if ((uids = malloc(sizeof (*uids))) == NULL) - err(1, "malloc"); + errx(1, "malloc failed"); nuids = 1; *uids = getuid(); } @@ -343,7 +343,7 @@ main(int argc, char *argv[]) if ((kp = kvm_getprocs(kd, what, flag, &nentries)) == 0 || nentries < 0) errx(1, "%s", kvm_geterr(kd)); if ((kinfo = malloc(nentries * sizeof(*kinfo))) == NULL) - err(1, NULL); + errx(1, "malloc failed"); for (i = nentries; --i >= 0; ++kp) { kinfo[i].ki_p = kp; if (needuser) @@ -424,7 +424,7 @@ getuids(const char *arg, int *nuids) moreuids = realloc(uids, alloc * sizeof (*uids)); if (moreuids == NULL) { free(uids); - err(1, "realloc"); + errx(1, "realloc failed"); } uids = moreuids; } @@ -500,8 +500,6 @@ fmt(char **(*fn)(kvm_t *, const struct kinfo_proc *, int), KINFO *ki, const char *s; s = fmt_argv((*fn)(kd, ki->ki_p, termwidth), comm, maxlen); - if (s == NULL) - err(1, NULL); return (s); } @@ -578,7 +576,7 @@ kludge_oldps_options(char *s) len = strlen(s); if ((newopts = ns = malloc(len + 2)) == NULL) - err(1, NULL); + errx(1, "malloc failed"); /* * options begin with '-' */ |