diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2018-01-16 22:52:33 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2018-01-16 22:52:33 +0000 |
commit | 912194b99b5052b815d28bd8ce3752c1212af241 (patch) | |
tree | c9008f1acdeb7347f50f1720a55e5ef04012d98e /bin | |
parent | 4a4314b548e46aa0214ec94a4f342d830019a314 (diff) |
Introduce internal_warningf() and mark internal_errorf() as noreturn
This helps tools like scan-build, and follows the example of warningf()
and errorf(). ok anton@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ksh/alloc.c | 12 | ||||
-rw-r--r-- | bin/ksh/c_ksh.c | 4 | ||||
-rw-r--r-- | bin/ksh/c_ulimit.c | 4 | ||||
-rw-r--r-- | bin/ksh/edit.c | 8 | ||||
-rw-r--r-- | bin/ksh/eval.c | 8 | ||||
-rw-r--r-- | bin/ksh/exec.c | 10 | ||||
-rw-r--r-- | bin/ksh/io.c | 38 | ||||
-rw-r--r-- | bin/ksh/jobs.c | 18 | ||||
-rw-r--r-- | bin/ksh/main.c | 6 | ||||
-rw-r--r-- | bin/ksh/misc.c | 4 | ||||
-rw-r--r-- | bin/ksh/sh.h | 8 | ||||
-rw-r--r-- | bin/ksh/shf.c | 36 | ||||
-rw-r--r-- | bin/ksh/table.c | 4 | ||||
-rw-r--r-- | bin/ksh/trap.c | 4 | ||||
-rw-r--r-- | bin/ksh/tree.c | 4 | ||||
-rw-r--r-- | bin/ksh/var.c | 4 | ||||
-rw-r--r-- | bin/ksh/vi.c | 4 |
17 files changed, 97 insertions, 79 deletions
diff --git a/bin/ksh/alloc.c b/bin/ksh/alloc.c index e3129bfe1fe..204e835890c 100644 --- a/bin/ksh/alloc.c +++ b/bin/ksh/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.18 2017/11/02 06:55:35 tb Exp $ */ +/* $OpenBSD: alloc.c,v 1.19 2018/01/16 22:52:32 jca Exp $ */ /* Public domain, like most of the rest of ksh */ @@ -45,11 +45,11 @@ alloc(size_t size, Area *ap) /* ensure that we don't overflow by allocating space for link */ if (size > SIZE_MAX - sizeof(struct link)) - internal_errorf(1, "unable to allocate memory"); + internal_errorf("unable to allocate memory"); l = malloc(sizeof(struct link) + size); if (l == NULL) - internal_errorf(1, "unable to allocate memory"); + internal_errorf("unable to allocate memory"); l->next = ap->freelist; l->prev = NULL; if (ap->freelist) @@ -73,7 +73,7 @@ areallocarray(void *ptr, size_t nmemb, size_t size, Area *ap) /* condition logic cloned from calloc() */ if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && nmemb > 0 && SIZE_MAX / nmemb < size) { - internal_errorf(1, "unable to allocate memory"); + internal_errorf("unable to allocate memory"); } return aresize(ptr, nmemb * size, ap); @@ -89,7 +89,7 @@ aresize(void *ptr, size_t size, Area *ap) /* ensure that we don't overflow by allocating space for link */ if (size > SIZE_MAX - sizeof(struct link)) - internal_errorf(1, "unable to allocate memory"); + internal_errorf("unable to allocate memory"); l = P2L(ptr); lprev = l->prev; @@ -97,7 +97,7 @@ aresize(void *ptr, size_t size, Area *ap) l2 = realloc(l, sizeof(struct link) + size); if (l2 == NULL) - internal_errorf(1, "unable to allocate memory"); + internal_errorf("unable to allocate memory"); if (lprev) lprev->next = l2; else diff --git a/bin/ksh/c_ksh.c b/bin/ksh/c_ksh.c index f939114c9a5..a78b7da12e9 100644 --- a/bin/ksh/c_ksh.c +++ b/bin/ksh/c_ksh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_ksh.c,v 1.57 2018/01/15 14:58:05 jca Exp $ */ +/* $OpenBSD: c_ksh.c,v 1.58 2018/01/16 22:52:32 jca Exp $ */ /* * built-in Korn commands: c_* @@ -1273,7 +1273,7 @@ c_getopts(char **wp) } if (genv->loc->next == NULL) { - internal_errorf(0, "c_getopts: no argv"); + internal_warningf("c_getopts: no argv"); return 1; } /* Which arguments are we parsing... */ diff --git a/bin/ksh/c_ulimit.c b/bin/ksh/c_ulimit.c index e8f9c208dee..1ce0b66577c 100644 --- a/bin/ksh/c_ulimit.c +++ b/bin/ksh/c_ulimit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_ulimit.c,v 1.25 2018/01/16 20:40:43 anton Exp $ */ +/* $OpenBSD: c_ulimit.c,v 1.26 2018/01/16 22:52:32 jca Exp $ */ /* ulimit -- handle "ulimit" builtin @@ -97,7 +97,7 @@ c_ulimit(char **wp) for (l = limits; l->name && l->option != optc; l++) ; if (!l->name) { - internal_errorf(0, "ulimit: %c", optc); + internal_warningf("ulimit: %c", optc); return 1; } if (builtin_opt.optarg) { diff --git a/bin/ksh/edit.c b/bin/ksh/edit.c index d7f2c03bc83..9cfaa197d6a 100644 --- a/bin/ksh/edit.c +++ b/bin/ksh/edit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: edit.c,v 1.62 2018/01/15 14:58:05 jca Exp $ */ +/* $OpenBSD: edit.c,v 1.63 2018/01/16 22:52:32 jca Exp $ */ /* * Command line editing - common code @@ -372,7 +372,7 @@ x_file_glob(int flags, const char *str, int slen, char ***wordsp) source = s; if (yylex(ONEWORD|UNESCAPE) != LWORD) { source = sold; - internal_errorf(0, "fileglob: substitute error"); + internal_warningf("fileglob: substitute error"); return 0; } source = sold; @@ -616,12 +616,12 @@ x_try_array(const char *buf, int buflen, const char *want, int wantlen, /* Try to find the array. */ if (asprintf(&name, "complete_%.*s_%d", cmdlen, cmd, n) < 0) - internal_errorf(1, "unable to allocate memory"); + internal_errorf("unable to allocate memory"); v = global(name); free(name); if (~v->flag & (ISSET|ARRAY)) { if (asprintf(&name, "complete_%.*s", cmdlen, cmd) < 0) - internal_errorf(1, "unable to allocate memory"); + internal_errorf("unable to allocate memory"); v = global(name); free(name); if (~v->flag & (ISSET|ARRAY)) diff --git a/bin/ksh/eval.c b/bin/ksh/eval.c index 7bc9b8bd721..a8dc698bd44 100644 --- a/bin/ksh/eval.c +++ b/bin/ksh/eval.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.58 2018/01/14 16:04:21 anton Exp $ */ +/* $OpenBSD: eval.c,v 1.59 2018/01/16 22:52:32 jca Exp $ */ /* * Expansion - quoting, separation, substitution, globbing @@ -69,7 +69,7 @@ substitute(const char *cp, int f) s->start = s->str = cp; source = s; if (yylex(ONEWORD) != LWORD) - internal_errorf(1, "substitute"); + internal_errorf("substitute"); source = sold; afree(s, ATEMP); return evalstr(yylval.cp, f); @@ -168,7 +168,7 @@ expand(char *cp, /* input word */ size_t len; if (cp == NULL) - internal_errorf(1, "expand(NULL)"); + internal_errorf("expand(NULL)"); /* for alias, readonly, set, typeset commands */ if ((f & DOVACHECK) && is_wdvarassign(cp)) { f &= ~(DOVACHECK|DOBLANK|DOGLOB|DOTILDE); @@ -587,7 +587,7 @@ expand(char *cp, /* input word */ char *p; if ((p = strdup("")) == NULL) - internal_errorf(1, "unable " + internal_errorf("unable " "to allocate memory"); XPput(*wp, p); } diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c index ad25879ed6b..a53ba5fdfdb 100644 --- a/bin/ksh/exec.c +++ b/bin/ksh/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.71 2018/01/15 14:58:05 jca Exp $ */ +/* $OpenBSD: exec.c,v 1.72 2018/01/16 22:52:32 jca Exp $ */ /* * execute command tree @@ -644,7 +644,7 @@ comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags, /* NOTREACHED */ default: quitenv(NULL); - internal_errorf(1, "CFUNC %d", i); + internal_errorf("CFUNC %d", i); } break; } @@ -727,7 +727,7 @@ shcomexec(char **wp) tp = ktsearch(&builtins, *wp, hash(*wp)); if (tp == NULL) - internal_errorf(1, "shcomexec: %s", *wp); + internal_errorf("shcomexec: %s", *wp); return call_builtin(tp, wp); } @@ -1221,7 +1221,7 @@ herein(const char *content, int sub) s->start = s->str = content; source = s; if (yylex(ONEWORD|HEREDOC) != LWORD) - internal_errorf(1, "herein: yylex"); + internal_errorf("herein: yylex"); source = osource; shf_puts(evalstr(yylval.cp, 0), shf); } else @@ -1446,5 +1446,5 @@ static void dbteste_error(Test_env *te, int offset, const char *msg) { te->flags |= TEF_ERROR; - internal_errorf(0, "dbteste_error: %s (offset %d)", msg, offset); + internal_warningf("dbteste_error: %s (offset %d)", msg, offset); } diff --git a/bin/ksh/io.c b/bin/ksh/io.c index 16a0709f1ba..5d8f1564c72 100644 --- a/bin/ksh/io.c +++ b/bin/ksh/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.35 2016/03/20 00:01:21 krw Exp $ */ +/* $OpenBSD: io.c,v 1.36 2018/01/16 22:52:32 jca Exp $ */ /* * shell buffered IO and formatted output @@ -86,21 +86,37 @@ bi_errorf(const char *fmt, ...) } } -/* Called when something that shouldn't happen does */ -void -internal_errorf(int jump, const char *fmt, ...) +static void +internal_error_vwarn(const char *fmt, va_list va) { - va_list va; - error_prefix(true); shf_fprintf(shl_out, "internal error: "); - va_start(va, fmt); shf_vfprintf(shl_out, fmt, va); - va_end(va); shf_putchar('\n', shl_out); shf_flush(shl_out); - if (jump) - unwind(LERROR); +} + +/* Warn when something that shouldn't happen does */ +void +internal_warningf(const char *fmt, ...) +{ + va_list va; + + va_start(va, fmt); + internal_error_vwarn(fmt, va); + va_end(va); +} + +/* Warn and unwind when something that shouldn't happen does */ +__dead void +internal_errorf(const char *fmt, ...) +{ + va_list va; + + va_start(va, fmt); + internal_error_vwarn(fmt, va); + va_end(va); + unwind(LERROR); } /* used by error reporting functions to print "ksh: .kshrc[25]: " */ @@ -139,7 +155,7 @@ shprintf(const char *fmt, ...) va_list va; if (!shl_stdout_ok) - internal_errorf(1, "shl_stdout not valid"); + internal_errorf("shl_stdout not valid"); va_start(va, fmt); shf_vfprintf(shl_stdout, fmt, va); va_end(va); diff --git a/bin/ksh/jobs.c b/bin/ksh/jobs.c index c648950e60a..f437fe69c68 100644 --- a/bin/ksh/jobs.c +++ b/bin/ksh/jobs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: jobs.c,v 1.58 2018/01/08 22:22:28 benno Exp $ */ +/* $OpenBSD: jobs.c,v 1.59 2018/01/16 22:52:32 jca Exp $ */ /* * Process and job control @@ -411,7 +411,7 @@ exchild(struct op *t, int flags, volatile int *xerrok, /* link process into jobs list */ if (flags&XPIPEI) { /* continuing with a pipe */ if (!last_job) - internal_errorf(1, + internal_errorf( "exchild: XPIPEI and no last_job - pid %d", (int) procpid); j = last_job; @@ -522,7 +522,7 @@ exchild(struct op *t, int flags, volatile int *xerrok, tty_close(); cleartraps(); execute(t, (flags & XERROK) | XEXEC, NULL); /* no return */ - internal_errorf(0, "exchild: execute() returned"); + internal_warningf("exchild: execute() returned"); unwind(LLEAVE); /* NOTREACHED */ } @@ -590,7 +590,7 @@ waitlast(void) if (!j) warningf(true, "waitlast: no last job"); else - internal_errorf(0, "waitlast: not started"); + internal_warningf("waitlast: not started"); sigprocmask(SIG_SETMASK, &omask, NULL); return 125; /* not so arbitrary, non-zero value */ } @@ -931,7 +931,7 @@ j_set_async(Job *j) if (async_job && (async_job->flags & (JF_KNOWN|JF_ZOMBIE)) == JF_ZOMBIE) remove_job(async_job, "async"); if (!(j->flags & JF_STARTED)) { - internal_errorf(0, "j_async: job not started"); + internal_warningf("j_async: job not started"); return; } async_job = j; @@ -945,8 +945,8 @@ j_set_async(Job *j) if (!oldest) { /* XXX debugging */ if (!(async_job->flags & JF_ZOMBIE) || nzombie != 1) { - internal_errorf(0, - "j_async: bad nzombie (%d)", nzombie); + internal_warningf("j_async: bad nzombie (%d)", + nzombie); nzombie = 0; } break; @@ -1186,7 +1186,7 @@ check_job(Job *j) /* XXX debugging (nasty - interrupt routine using shl_out) */ if (!(j->flags & JF_STARTED)) { - internal_errorf(0, "check_job: job started (flags 0x%x)", + internal_warningf("check_job: job started (flags 0x%x)", j->flags); return; } @@ -1546,7 +1546,7 @@ remove_job(Job *j, const char *where) for (; curr != NULL && curr != j; prev = &curr->next, curr = *prev) ; if (curr != j) { - internal_errorf(0, "remove_job: job not found (%s)", where); + internal_warningf("remove_job: job not found (%s)", where); return; } *prev = curr->next; diff --git a/bin/ksh/main.c b/bin/ksh/main.c index ae2220ea1ea..a162d75069e 100644 --- a/bin/ksh/main.c +++ b/bin/ksh/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.88 2018/01/15 14:58:05 jca Exp $ */ +/* $OpenBSD: main.c,v 1.89 2018/01/16 22:52:32 jca Exp $ */ /* * startup, main loop, environments and error handling @@ -492,7 +492,7 @@ include(const char *name, int argc, char **argv, int intr_ok) unwind(i); /* NOTREACHED */ default: - internal_errorf(1, "include: %d", i); + internal_errorf("include: %d", i); /* NOTREACHED */ } } @@ -579,7 +579,7 @@ shell(Source *volatile s, volatile int toplevel) default: source = old_source; quitenv(NULL); - internal_errorf(1, "shell: %d", i); + internal_errorf("shell: %d", i); /* NOTREACHED */ } } diff --git a/bin/ksh/misc.c b/bin/ksh/misc.c index 4d2bb22499c..fab34c12133 100644 --- a/bin/ksh/misc.c +++ b/bin/ksh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.67 2018/01/15 14:58:05 jca Exp $ */ +/* $OpenBSD: misc.c,v 1.68 2018/01/16 22:52:32 jca Exp $ */ /* * Miscellaneous functions @@ -407,7 +407,7 @@ parse_args(char **argv, break; } if (ele == NELEM(sh_options)) { - internal_errorf(1, "parse_args: `%c'", optc); + internal_errorf("parse_args: `%c'", optc); return -1; /* not reached */ } } diff --git a/bin/ksh/sh.h b/bin/ksh/sh.h index 2203578aeda..b14290bf933 100644 --- a/bin/ksh/sh.h +++ b/bin/ksh/sh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sh.h,v 1.70 2018/01/15 14:58:05 jca Exp $ */ +/* $OpenBSD: sh.h,v 1.71 2018/01/16 22:52:32 jca Exp $ */ /* * Public Domain Bourne/Korn shell @@ -464,8 +464,10 @@ void warningf(bool, const char *, ...) __attribute__((__format__ (printf, 2, 3))); void bi_errorf(const char *, ...) __attribute__((__format__ (printf, 1, 2))); -void internal_errorf(int, const char *, ...) - __attribute__((__format__ (printf, 2, 3))); +void internal_errorf(const char *, ...) + __attribute__((__noreturn__, __format__ (printf, 1, 2))); +void internal_warningf(const char *, ...) + __attribute__((__format__ (printf, 1, 2))); void error_prefix(int); void shellf(const char *, ...) __attribute__((__format__ (printf, 1, 2))); diff --git a/bin/ksh/shf.c b/bin/ksh/shf.c index 68be9b90190..693ee1fab6a 100644 --- a/bin/ksh/shf.c +++ b/bin/ksh/shf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shf.c,v 1.31 2016/03/20 00:01:21 krw Exp $ */ +/* $OpenBSD: shf.c,v 1.32 2018/01/16 22:52:32 jca Exp $ */ /* * Shell file I/O routines @@ -100,7 +100,7 @@ shf_fdopen(int fd, int sflags, struct shf *shf) } if (!(sflags & (SHF_RD | SHF_WR))) - internal_errorf(1, "shf_fdopen: missing read/write"); + internal_errorf("shf_fdopen: missing read/write"); if (shf) { if (bsize) { @@ -157,9 +157,9 @@ shf_reopen(int fd, int sflags, struct shf *shf) } if (!(sflags & (SHF_RD | SHF_WR))) - internal_errorf(1, "shf_reopen: missing read/write"); + internal_errorf("shf_reopen: missing read/write"); if (!shf || !shf->buf || shf->bsize < bsize) - internal_errorf(1, "shf_reopen: bad shf/buf/bsize"); + internal_errorf("shf_reopen: bad shf/buf/bsize"); /* assumes shf->buf and shf->bsize already set up */ shf->fd = fd; @@ -189,7 +189,7 @@ shf_sopen(char *buf, int bsize, int sflags, struct shf *shf) /* can't have a read+write string */ if (!(sflags & (SHF_RD | SHF_WR)) || (sflags & (SHF_RD | SHF_WR)) == (SHF_RD | SHF_WR)) - internal_errorf(1, "shf_sopen: flags 0x%x", sflags); + internal_errorf("shf_sopen: flags 0x%x", sflags); if (!shf) { shf = alloc(sizeof(struct shf), ATEMP); @@ -282,7 +282,7 @@ shf_flush(struct shf *shf) return (shf->flags & SHF_WR) ? EOF : 0; if (shf->fd < 0) - internal_errorf(1, "shf_flush: no fd"); + internal_errorf("shf_flush: no fd"); if (shf->flags & SHF_ERROR) { errno = shf->errno_; @@ -312,7 +312,7 @@ shf_emptybuf(struct shf *shf, int flags) int ret = 0; if (!(shf->flags & SHF_STRING) && shf->fd < 0) - internal_errorf(1, "shf_emptybuf: no fd"); + internal_errorf("shf_emptybuf: no fd"); if (shf->flags & SHF_ERROR) { errno = shf->errno_; @@ -392,7 +392,7 @@ shf_fillbuf(struct shf *shf) return 0; if (shf->fd < 0) - internal_errorf(1, "shf_fillbuf: no fd"); + internal_errorf("shf_fillbuf: no fd"); if (shf->flags & (SHF_EOF | SHF_ERROR)) { if (shf->flags & SHF_ERROR) @@ -438,10 +438,10 @@ shf_read(char *buf, int bsize, struct shf *shf) int ncopy; if (!(shf->flags & SHF_RD)) - internal_errorf(1, "shf_read: flags %x", shf->flags); + internal_errorf("shf_read: flags %x", shf->flags); if (bsize <= 0) - internal_errorf(1, "shf_read: bsize %d", bsize); + internal_errorf("shf_read: bsize %d", bsize); while (bsize > 0) { if (shf->rnleft == 0 && @@ -473,7 +473,7 @@ shf_getse(char *buf, int bsize, struct shf *shf) char *orig_buf = buf; if (!(shf->flags & SHF_RD)) - internal_errorf(1, "shf_getse: flags %x", shf->flags); + internal_errorf("shf_getse: flags %x", shf->flags); if (bsize <= 0) return NULL; @@ -508,7 +508,7 @@ int shf_getchar(struct shf *shf) { if (!(shf->flags & SHF_RD)) - internal_errorf(1, "shf_getchar: flags %x", shf->flags); + internal_errorf("shf_getchar: flags %x", shf->flags); if (shf->rnleft == 0 && (shf_fillbuf(shf) == EOF || shf->rnleft == 0)) return EOF; @@ -523,7 +523,7 @@ int shf_ungetc(int c, struct shf *shf) { if (!(shf->flags & SHF_RD)) - internal_errorf(1, "shf_ungetc: flags %x", shf->flags); + internal_errorf("shf_ungetc: flags %x", shf->flags); if ((shf->flags & SHF_ERROR) || c == EOF || (shf->rp == shf->buf && shf->rnleft)) @@ -558,7 +558,7 @@ int shf_putchar(int c, struct shf *shf) { if (!(shf->flags & SHF_WR)) - internal_errorf(1, "shf_putchar: flags %x", shf->flags); + internal_errorf("shf_putchar: flags %x", shf->flags); if (c == EOF) return EOF; @@ -568,7 +568,7 @@ shf_putchar(int c, struct shf *shf) int n; if (shf->fd < 0) - internal_errorf(1, "shf_putchar: no fd"); + internal_errorf("shf_putchar: no fd"); if (shf->flags & SHF_ERROR) { errno = shf->errno_; return EOF; @@ -614,10 +614,10 @@ shf_write(const char *buf, int nbytes, struct shf *shf) int ncopy; if (!(shf->flags & SHF_WR)) - internal_errorf(1, "shf_write: flags %x", shf->flags); + internal_errorf("shf_write: flags %x", shf->flags); if (nbytes < 0) - internal_errorf(1, "shf_write: nbytes %d", nbytes); + internal_errorf("shf_write: nbytes %d", nbytes); /* Don't buffer if buffer is empty and we're writting a large amount. */ if ((ncopy = shf->wnleft) && @@ -687,7 +687,7 @@ shf_snprintf(char *buf, int bsize, const char *fmt, ...) int n; if (!buf || bsize <= 0) - internal_errorf(1, "shf_snprintf: buf %lx, bsize %d", + internal_errorf("shf_snprintf: buf %lx, bsize %d", (long) buf, bsize); shf_sopen(buf, bsize, SHF_WR, &shf); diff --git a/bin/ksh/table.c b/bin/ksh/table.c index d93ecddb9f2..32845dd2eee 100644 --- a/bin/ksh/table.c +++ b/bin/ksh/table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table.c,v 1.24 2017/12/27 13:02:57 millert Exp $ */ +/* $OpenBSD: table.c,v 1.25 2018/01/16 22:52:32 jca Exp $ */ /* * dynamic hashed associative table for commands and variables @@ -128,7 +128,7 @@ ktenter(struct table *tp, const char *n, unsigned int h) if (tp->size <= INT_MAX/2) texpand(tp, 2*tp->size); else - internal_errorf(1, "too many vars"); + internal_errorf("too many vars"); goto Search; } diff --git a/bin/ksh/trap.c b/bin/ksh/trap.c index 3144ea64dc3..d047047cc23 100644 --- a/bin/ksh/trap.c +++ b/bin/ksh/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.30 2016/03/17 23:33:23 mmcc Exp $ */ +/* $OpenBSD: trap.c,v 1.31 2018/01/16 22:52:32 jca Exp $ */ /* * signal handling @@ -402,7 +402,7 @@ setexecsig(Trap *p, int restore) { /* XXX debugging */ if (!(p->flags & (TF_ORIG_IGN|TF_ORIG_DFL))) - internal_errorf(1, "setexecsig: unset signal %d(%s)", + internal_errorf("setexecsig: unset signal %d(%s)", p->signal, p->name); /* restore original value for exec'd kids */ diff --git a/bin/ksh/tree.c b/bin/ksh/tree.c index 71081c891f9..dff0726a48d 100644 --- a/bin/ksh/tree.c +++ b/bin/ksh/tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.c,v 1.30 2018/01/06 16:28:58 millert Exp $ */ +/* $OpenBSD: tree.c,v 1.31 2018/01/16 22:52:32 jca Exp $ */ /* * command tree climbing @@ -549,7 +549,7 @@ wdscan(const char *wp, int c) nest--; break; default: - internal_errorf(0, + internal_warningf( "wdscan: unknown char 0x%x (carrying on)", wp[-1]); } diff --git a/bin/ksh/var.c b/bin/ksh/var.c index a3a9b7cd960..96c745e705d 100644 --- a/bin/ksh/var.c +++ b/bin/ksh/var.c @@ -1,4 +1,4 @@ -/* $OpenBSD: var.c,v 1.64 2018/01/15 14:58:05 jca Exp $ */ +/* $OpenBSD: var.c,v 1.65 2018/01/16 22:52:32 jca Exp $ */ #include <sys/stat.h> @@ -366,7 +366,7 @@ setstr(struct tbl *vq, const char *s, int error_ok) /* debugging */ if (s >= vq->val.s && s <= vq->val.s + strlen(vq->val.s)) - internal_errorf(true, + internal_errorf( "setstr: %s=%s: assigning to self", vq->name, s); afree(vq->val.s, vq->areap); diff --git a/bin/ksh/vi.c b/bin/ksh/vi.c index ff677752170..d0bd785a461 100644 --- a/bin/ksh/vi.c +++ b/bin/ksh/vi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vi.c,v 1.54 2018/01/13 02:06:54 schwarze Exp $ */ +/* $OpenBSD: vi.c,v 1.55 2018/01/16 22:52:32 jca Exp $ */ /* * vi command editing @@ -1669,7 +1669,7 @@ grabhist(int save, int n) } (void) histnum(n); if ((hptr = *histpos()) == NULL) { - internal_errorf(0, "grabhist: bad history array"); + internal_warningf("grabhist: bad history array"); return -1; } if (save) |