xref: /netbsd-src/crypto/external/bsd/openssh/dist/fatal.c (revision 17418e98f281f84e3d22de9717222f9c2ee84d3a)
1*17418e98Schristos /*	$NetBSD: fatal.c,v 1.7 2021/03/05 17:47:16 christos Exp $	*/
2*17418e98Schristos /* $OpenBSD: fatal.c,v 1.11 2020/10/19 08:07:08 djm Exp $ */
3*17418e98Schristos 
4ca32bd8dSchristos /*
5ca32bd8dSchristos  * Copyright (c) 2002 Markus Friedl.  All rights reserved.
6ca32bd8dSchristos  *
7ca32bd8dSchristos  * Redistribution and use in source and binary forms, with or without
8ca32bd8dSchristos  * modification, are permitted provided that the following conditions
9ca32bd8dSchristos  * are met:
10ca32bd8dSchristos  * 1. Redistributions of source code must retain the above copyright
11ca32bd8dSchristos  *    notice, this list of conditions and the following disclaimer.
12ca32bd8dSchristos  * 2. Redistributions in binary form must reproduce the above copyright
13ca32bd8dSchristos  *    notice, this list of conditions and the following disclaimer in the
14ca32bd8dSchristos  *    documentation and/or other materials provided with the distribution.
15ca32bd8dSchristos  *
16ca32bd8dSchristos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17ca32bd8dSchristos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18ca32bd8dSchristos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19ca32bd8dSchristos  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20ca32bd8dSchristos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21ca32bd8dSchristos  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22ca32bd8dSchristos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23ca32bd8dSchristos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24ca32bd8dSchristos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25ca32bd8dSchristos  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26ca32bd8dSchristos  */
27ca32bd8dSchristos 
28313c6c94Schristos #include "includes.h"
29*17418e98Schristos __RCSID("$NetBSD: fatal.c,v 1.7 2021/03/05 17:47:16 christos Exp $");
30ca32bd8dSchristos #include <sys/types.h>
31ca32bd8dSchristos 
32ca32bd8dSchristos #include <stdarg.h>
33ca32bd8dSchristos 
34ca32bd8dSchristos #include "log.h"
35ca32bd8dSchristos 
36ca32bd8dSchristos /* Fatal messages.  This function never returns. */
37ca32bd8dSchristos 
38ca32bd8dSchristos void
sshfatal(const char * file,const char * func,int line,int showfunc,LogLevel level,const char * suffix,const char * fmt,...)39*17418e98Schristos sshfatal(const char *file, const char *func, int line, int showfunc,
40*17418e98Schristos     LogLevel level, const char *suffix, const char *fmt, ...)
41ca32bd8dSchristos {
42ca32bd8dSchristos 	va_list args;
43ca32bd8dSchristos 
44ca32bd8dSchristos 	va_start(args, fmt);
45*17418e98Schristos 	sshlogv(file, func, line, showfunc, level, suffix, fmt, args);
46ca32bd8dSchristos 	va_end(args);
47ca32bd8dSchristos 	cleanup_exit(255);
48ca32bd8dSchristos }
49