diff options
| author | perry <perry@NetBSD.org> | 2002-02-02 23:10:24 +0000 |
|---|---|---|
| committer | perry <perry@NetBSD.org> | 2002-02-02 23:10:24 +0000 |
| commit | 6f59dc7aebbf705da79e61ef3fd24b48ed99d327 (patch) | |
| tree | c6e9fd356c8aac78b966a9dd53f5d0d14d5e62cd /gnu/dist/postfix/src/util/msg.c | |
| parent | ecf43984517b4cfb837e78958769cc8207ea5288 (diff) | |
Postfix 1.1.2
(Postfix releases are now numbered -- 1.1.2 means 1.1, patchlevel 2.)
Lots of new features, same great security.
Diffstat (limited to 'gnu/dist/postfix/src/util/msg.c')
| -rw-r--r-- | gnu/dist/postfix/src/util/msg.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/gnu/dist/postfix/src/util/msg.c b/gnu/dist/postfix/src/util/msg.c index 08379a90b86..683359b2b37 100644 --- a/gnu/dist/postfix/src/util/msg.c +++ b/gnu/dist/postfix/src/util/msg.c @@ -20,6 +20,10 @@ /* NORETURN msg_fatal(format, ...) /* const char *format; /* +/* NORETURN msg_fatal_status(status, format, ...) +/* int status; +/* const char *format; +/* /* NORETURN msg_panic(format, ...) /* const char *format; /* @@ -48,11 +52,14 @@ /* msg_fatal() reports an unrecoverable error and terminates the program /* with a non-zero exit status. /* +/* msg_fatal_status() reports an unrecoverable error and terminates the +/* program with the specified exit status. +/* /* msg_panic() reports an internal inconsistency, terminates the /* program immediately (i.e. without calling the optional user-specified /* cleanup routine), and forces a core dump when possible. /* -/* msg_cleanup() specifies a function that msg_fatal() should +/* msg_cleanup() specifies a function that msg_fatal[_status]() should /* invoke before terminating the program, and returns the /* current function pointer. Specify a null argument to disable /* this feature. @@ -163,6 +170,23 @@ NORETURN msg_fatal(const char *fmt,...) exit(1); } +/* msg_fatal_status - report error and terminate gracefully */ + +NORETURN msg_fatal_status(int status, const char *fmt,...) +{ + va_list ap; + + if (msg_exiting++ == 0) { + va_start(ap, fmt); + msg_vprintf(MSG_FATAL, fmt, ap); + va_end(ap); + if (msg_cleanup_fn) + msg_cleanup_fn(); + } + sleep(1); + exit(status); +} + /* msg_panic - report error and dump core */ NORETURN msg_panic(const char *fmt,...) |
