diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2007-05-26 20:13:46 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2007-05-26 20:13:46 +0000 |
commit | 1f9e3472bcc41e802d220fc7b56c96c08725cf35 (patch) | |
tree | f1c64954da94983ed4662d4220c72b81ea8e536c /usr.bin | |
parent | df62462b815791428e5b6fe450ccd67982196edc (diff) |
fatal() should never be called twice; if it happens, exit immediately,
it is the only safe thing to do.
OK niallo@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/fatal.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/cvs/fatal.c b/usr.bin/cvs/fatal.c index 0d112eecd29..94c288516e1 100644 --- a/usr.bin/cvs/fatal.c +++ b/usr.bin/cvs/fatal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fatal.c,v 1.9 2007/02/22 06:42:09 otto Exp $ */ +/* $OpenBSD: fatal.c,v 1.10 2007/05/26 20:13:45 ray Exp $ */ /* * Copyright (c) 2002 Markus Friedl. All rights reserved. * @@ -36,8 +36,13 @@ void fatal(const char *fmt,...) { + static int been_here; va_list args; + /* Fatal should not loop, (the functions below can fatal). */ + if (been_here++) + goto end; + va_start(args, fmt); cvs_vlog(LP_ABORT, fmt, args); va_end(args); @@ -47,5 +52,6 @@ fatal(const char *fmt,...) if (cvs_server_active) cvs_server_send_response("error"); + end: exit(1); } |