xref: /openssh-portable/fatal.c (revision 3554b4af)
1*3554b4afSdjm@openbsd.org /* $OpenBSD: fatal.c,v 1.9 2020/10/17 01:28:20 djm Exp $ */
288c0cd85SBen Lindstrom /*
388c0cd85SBen Lindstrom  * Copyright (c) 2002 Markus Friedl.  All rights reserved.
488c0cd85SBen Lindstrom  *
588c0cd85SBen Lindstrom  * Redistribution and use in source and binary forms, with or without
688c0cd85SBen Lindstrom  * modification, are permitted provided that the following conditions
788c0cd85SBen Lindstrom  * are met:
888c0cd85SBen Lindstrom  * 1. Redistributions of source code must retain the above copyright
988c0cd85SBen Lindstrom  *    notice, this list of conditions and the following disclaimer.
1088c0cd85SBen Lindstrom  * 2. Redistributions in binary form must reproduce the above copyright
1188c0cd85SBen Lindstrom  *    notice, this list of conditions and the following disclaimer in the
1288c0cd85SBen Lindstrom  *    documentation and/or other materials provided with the distribution.
1388c0cd85SBen Lindstrom  *
1488c0cd85SBen Lindstrom  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1588c0cd85SBen Lindstrom  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1688c0cd85SBen Lindstrom  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1788c0cd85SBen Lindstrom  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1888c0cd85SBen Lindstrom  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1988c0cd85SBen Lindstrom  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2088c0cd85SBen Lindstrom  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2188c0cd85SBen Lindstrom  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2288c0cd85SBen Lindstrom  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2388c0cd85SBen Lindstrom  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2488c0cd85SBen Lindstrom  */
2588c0cd85SBen Lindstrom 
2688c0cd85SBen Lindstrom #include "includes.h"
2788c0cd85SBen Lindstrom 
28d7834353SDamien Miller #include <sys/types.h>
29d7834353SDamien Miller 
305d19626aSDarren Tucker #include <stdarg.h>
315d19626aSDarren Tucker 
3288c0cd85SBen Lindstrom #include "log.h"
3388c0cd85SBen Lindstrom 
3488c0cd85SBen Lindstrom /* Fatal messages.  This function never returns. */
3588c0cd85SBen Lindstrom 
3688c0cd85SBen Lindstrom void
37*3554b4afSdjm@openbsd.org sshfatal(const char *file, const char *func, int line, int showfunc,
38*3554b4afSdjm@openbsd.org     LogLevel level, const char *fmt, ...)
3988c0cd85SBen Lindstrom {
4088c0cd85SBen Lindstrom 	va_list args;
414f7becb4SDamien Miller 
4288c0cd85SBen Lindstrom 	va_start(args, fmt);
43*3554b4afSdjm@openbsd.org 	ssh_log(file, func, line, showfunc, level, fmt, args);
4488c0cd85SBen Lindstrom 	va_end(args);
453e33cecfSDarren Tucker 	cleanup_exit(255);
4688c0cd85SBen Lindstrom }
47