xref: /dragonfly/crypto/openssh/fatal.c (revision 50a69bb5)
150a69bb5SSascha Wildner /* $OpenBSD: fatal.c,v 1.11 2020/10/19 08:07:08 djm Exp $ */
218de8d7fSPeter Avalos /*
318de8d7fSPeter Avalos  * Copyright (c) 2002 Markus Friedl.  All rights reserved.
418de8d7fSPeter Avalos  *
518de8d7fSPeter Avalos  * Redistribution and use in source and binary forms, with or without
618de8d7fSPeter Avalos  * modification, are permitted provided that the following conditions
718de8d7fSPeter Avalos  * are met:
818de8d7fSPeter Avalos  * 1. Redistributions of source code must retain the above copyright
918de8d7fSPeter Avalos  *    notice, this list of conditions and the following disclaimer.
1018de8d7fSPeter Avalos  * 2. Redistributions in binary form must reproduce the above copyright
1118de8d7fSPeter Avalos  *    notice, this list of conditions and the following disclaimer in the
1218de8d7fSPeter Avalos  *    documentation and/or other materials provided with the distribution.
1318de8d7fSPeter Avalos  *
1418de8d7fSPeter Avalos  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1518de8d7fSPeter Avalos  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1618de8d7fSPeter Avalos  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1718de8d7fSPeter Avalos  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1818de8d7fSPeter Avalos  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1918de8d7fSPeter Avalos  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2018de8d7fSPeter Avalos  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2118de8d7fSPeter Avalos  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2218de8d7fSPeter Avalos  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2318de8d7fSPeter Avalos  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2418de8d7fSPeter Avalos  */
2518de8d7fSPeter Avalos 
2618de8d7fSPeter Avalos #include "includes.h"
2718de8d7fSPeter Avalos 
2818de8d7fSPeter Avalos #include <sys/types.h>
2918de8d7fSPeter Avalos 
3018de8d7fSPeter Avalos #include <stdarg.h>
3118de8d7fSPeter Avalos 
3218de8d7fSPeter Avalos #include "log.h"
3318de8d7fSPeter Avalos 
3418de8d7fSPeter Avalos /* Fatal messages.  This function never returns. */
3518de8d7fSPeter Avalos 
3618de8d7fSPeter Avalos void
sshfatal(const char * file,const char * func,int line,int showfunc,LogLevel level,const char * suffix,const char * fmt,...)3750a69bb5SSascha Wildner sshfatal(const char *file, const char *func, int line, int showfunc,
3850a69bb5SSascha Wildner     LogLevel level, const char *suffix, const char *fmt, ...)
3918de8d7fSPeter Avalos {
4018de8d7fSPeter Avalos 	va_list args;
4118de8d7fSPeter Avalos 
4218de8d7fSPeter Avalos 	va_start(args, fmt);
4350a69bb5SSascha Wildner 	sshlogv(file, func, line, showfunc, level, suffix, fmt, args);
4418de8d7fSPeter Avalos 	va_end(args);
4518de8d7fSPeter Avalos 	cleanup_exit(255);
4618de8d7fSPeter Avalos }
47