use EXIT_FAILURE instead of 1
This commit is contained in:
parent
7e6759edb0
commit
b02b35c97e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: keyword.c,v 1.55 2017/12/09 14:56:54 kamil Exp $ */
|
||||
/* $NetBSD: keyword.c,v 1.56 2018/04/11 18:52:05 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993, 1994
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)keyword.c 8.5 (Berkeley) 4/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: keyword.c,v 1.55 2017/12/09 14:56:54 kamil Exp $");
|
||||
__RCSID("$NetBSD: keyword.c,v 1.56 2018/04/11 18:52:05 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -308,7 +308,7 @@ parsevarlist(const char *pp, struct varlist *listptr, struct varent **pos)
|
||||
if ((v = findvar(cp)) == NULL)
|
||||
continue;
|
||||
if ((vent = malloc(sizeof(struct varent))) == NULL)
|
||||
err(1, NULL);
|
||||
err(EXIT_FAILURE, NULL);
|
||||
vent->var = v;
|
||||
if (pos && *pos)
|
||||
SIMPLEQ_INSERT_AFTER(listptr, *pos, vent, next);
|
||||
@ -320,7 +320,7 @@ parsevarlist(const char *pp, struct varlist *listptr, struct varent **pos)
|
||||
}
|
||||
free(sp);
|
||||
if (SIMPLEQ_EMPTY(listptr))
|
||||
errx(1, "no valid keywords");
|
||||
errx(EXIT_FAILURE, "no valid keywords");
|
||||
}
|
||||
|
||||
void
|
||||
@ -389,9 +389,9 @@ findvar(const char *p)
|
||||
char *newheader;
|
||||
|
||||
if ((newvar = malloc(sizeof(struct var))) == NULL)
|
||||
err(1, NULL);
|
||||
err(EXIT_FAILURE, NULL);
|
||||
if ((newheader = strdup(hp)) == NULL)
|
||||
err(1, NULL);
|
||||
err(EXIT_FAILURE, NULL);
|
||||
memcpy(newvar, v, sizeof(struct var));
|
||||
newvar->header = newheader;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print.c,v 1.128 2017/12/09 14:56:54 kamil Exp $ */
|
||||
/* $NetBSD: print.c,v 1.129 2018/04/11 18:52:05 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
|
||||
@ -63,7 +63,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: print.c,v 1.128 2017/12/09 14:56:54 kamil Exp $");
|
||||
__RCSID("$NetBSD: print.c,v 1.129 2018/04/11 18:52:05 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -938,7 +938,7 @@ wchan(struct pinfo *pi, VARENT *ve, enum mode mode)
|
||||
(void)asprintf(&buf, "%-*" PRIx64, v->width,
|
||||
l->l_wchan);
|
||||
if (buf == NULL)
|
||||
err(1, "%s", "");
|
||||
err(EXIT_FAILURE, "%s", "");
|
||||
strprintorsetwidth(v, buf, mode);
|
||||
v->width = min(v->width, KI_WMESGLEN);
|
||||
free(buf);
|
||||
@ -1333,7 +1333,7 @@ printval(void *bp, VAR *v, enum mode mode)
|
||||
(void)printf(ofmt, width, CHK_INF127(GET(u_int64_t)));
|
||||
return;
|
||||
default:
|
||||
errx(1, "unknown type %d", v->type);
|
||||
errx(EXIT_FAILURE, "unknown type %d", v->type);
|
||||
}
|
||||
#undef GET
|
||||
#undef CHK_INF127
|
||||
|
24
bin/ps/ps.c
24
bin/ps/ps.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ps.c,v 1.89 2018/01/12 23:01:14 kamil Exp $ */
|
||||
/* $NetBSD: ps.c,v 1.90 2018/04/11 18:52:05 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000-2008 The NetBSD Foundation, Inc.
|
||||
@ -68,7 +68,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: ps.c,v 1.89 2018/01/12 23:01:14 kamil Exp $");
|
||||
__RCSID("$NetBSD: ps.c,v 1.90 2018/04/11 18:52:05 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -189,10 +189,10 @@ ttyname2dev(const char *ttname, int *xflg, int *what)
|
||||
return makedev(pts, ptsminor);
|
||||
}
|
||||
errno = serrno;
|
||||
err(1, "%s", ttypath);
|
||||
err(EXIT_FAILURE, "%s", ttypath);
|
||||
}
|
||||
if (!S_ISCHR(sb.st_mode))
|
||||
errx(1, "%s: not a terminal", ttypath);
|
||||
errx(EXIT_FAILURE, "%s: not a terminal", ttypath);
|
||||
return sb.st_rdev;
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
case 'T':
|
||||
if ((ttname = ttyname(STDIN_FILENO)) == NULL)
|
||||
errx(1, "stdin: not a terminal");
|
||||
errx(EXIT_FAILURE, "stdin: not a terminal");
|
||||
flag = ttyname2dev(ttname, &xflg, &what);
|
||||
break;
|
||||
case 't':
|
||||
@ -394,7 +394,7 @@ main(int argc, char *argv[])
|
||||
kd = kvm_openfiles(nlistf, memf, swapf, O_RDONLY, errbuf);
|
||||
|
||||
if (kd == NULL)
|
||||
errx(1, "%s", errbuf);
|
||||
errx(EXIT_FAILURE, "%s", errbuf);
|
||||
|
||||
if (!fmt)
|
||||
parsefmt(default_fmt);
|
||||
@ -425,7 +425,7 @@ main(int argc, char *argv[])
|
||||
* select procs
|
||||
*/
|
||||
if (!(kinfo = getkinfo_kvm(kd, what, flag, &nentries)))
|
||||
err(1, "%s", kvm_geterr(kd));
|
||||
err(EXIT_FAILURE, "%s", kvm_geterr(kd));
|
||||
if (nentries == 0) {
|
||||
printheader();
|
||||
return 1;
|
||||
@ -602,7 +602,7 @@ setpinfo(struct kinfo_proc2 *ki, int nentries, int calc_pcpu, int rawcpu)
|
||||
|
||||
pi = calloc(nentries, sizeof(*pi));
|
||||
if (pi == NULL)
|
||||
err(1, "calloc");
|
||||
err(EXIT_FAILURE, "calloc");
|
||||
|
||||
if (calc_pcpu && !nlistread)
|
||||
donlist();
|
||||
@ -763,7 +763,7 @@ kludge_oldps_options(char *s)
|
||||
|
||||
len = strlen(s);
|
||||
if ((newopts = ns = malloc(len + 3)) == NULL)
|
||||
err(1, NULL);
|
||||
err(EXIT_FAILURE, NULL);
|
||||
/*
|
||||
* options begin with '-'
|
||||
*/
|
||||
@ -815,10 +815,10 @@ parsenum(const char *str, const char *msg)
|
||||
ul = strtoul(str, &ep, 0);
|
||||
|
||||
if (*str == '\0' || *ep != '\0')
|
||||
errx(1, "Invalid %s: `%s'", msg, str);
|
||||
errx(EXIT_FAILURE, "Invalid %s: `%s'", msg, str);
|
||||
|
||||
if (ul > INT_MAX)
|
||||
errx(1, "Out of range %s: `%s'", msg, str);
|
||||
errx(EXIT_FAILURE, "Out of range %s: `%s'", msg, str);
|
||||
|
||||
return (int)ul;
|
||||
}
|
||||
@ -904,7 +904,7 @@ descendant_sort(struct pinfo *ki, int items)
|
||||
continue;
|
||||
}
|
||||
if ((ki[src].prefix = malloc(lvl * 2 + 1)) == NULL)
|
||||
errx(1, "malloc failed");
|
||||
errx(EXIT_FAILURE, "malloc failed");
|
||||
for (n = 0; n < lvl - 2; n++) {
|
||||
ki[src].prefix[n * 2] =
|
||||
path[n / 8] & 1 << (n % 8) ? '|' : ' ';
|
||||
|
Loading…
Reference in New Issue
Block a user