Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libutil provide a default error function instead of tryi...



details:   https://anonhg.NetBSD.org/src/rev/0a5b79951f3a
branches:  trunk
changeset: 459982:0a5b79951f3a
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Oct 03 18:12:44 2019 +0000

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

diffstat:

 lib/libutil/efun.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r f2ad8c15c96d -r 0a5b79951f3a lib/libutil/efun.c
--- a/lib/libutil/efun.c        Thu Oct 03 18:02:05 2019 +0000
+++ b/lib/libutil/efun.c        Thu Oct 03 18:12:44 2019 +0000
@@ -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 @@
 
 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;
 }
 



Home | Main Index | Thread Index | Old Index