provide a default error function instead of trying to cast exit(3).

This commit is contained in:
christos 2019-10-03 18:12:44 +00:00
parent d97b323d0b
commit 5c84fc8d45
1 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: efun.c,v 1.10 2015/07/26 02:20:30 kamil Exp $ */
/* $NetBSD: efun.c,v 1.11 2019/10/03 18:12:44 christos Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
__RCSID("$NetBSD: efun.c,v 1.10 2015/07/26 02:20:30 kamil Exp $");
__RCSID("$NetBSD: efun.c,v 1.11 2019/10/03 18:12:44 christos Exp $");
#endif
#include <err.h>
@ -49,11 +49,17 @@ __RCSID("$NetBSD: efun.c,v 1.10 2015/07/26 02:20:30 kamil Exp $");
static void (*efunc)(int, const char *, ...) = err;
static void
eexit(int e, const char *fmt __unused, ...)
{
exit(e);
}
void (*
esetfunc(void (*ef)(int, const char *, ...)))(int, const char *, ...)
{
void (*of)(int, const char *, ...) = efunc;
efunc = ef == NULL ? (void (*)(int, const char *, ...))exit : ef;
efunc = ef == NULL ? eexit : ef;
return of;
}