mirror of
git://anongit.mindrot.org/openssh.git
synced 2025-01-03 00:02:05 +00:00
upstream: make the log functions that exit (sshlogdie(),
sshfatal(), etc) have identical signatures. Makes things a bit more consistent... OpenBSD-Commit-ID: bd0ae124733389d7c0042e135c71ee9091362eb9
This commit is contained in:
parent
616029a85a
commit
3554b4afa3
7
fatal.c
7
fatal.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: fatal.c,v 1.8 2020/10/16 13:24:45 djm Exp $ */
|
/* $OpenBSD: fatal.c,v 1.9 2020/10/17 01:28:20 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002 Markus Friedl. All rights reserved.
|
* Copyright (c) 2002 Markus Friedl. All rights reserved.
|
||||||
*
|
*
|
||||||
@ -34,12 +34,13 @@
|
|||||||
/* Fatal messages. This function never returns. */
|
/* Fatal messages. This function never returns. */
|
||||||
|
|
||||||
void
|
void
|
||||||
sshfatal(const char *file, const char *func, int line, const char *fmt, ...)
|
sshfatal(const char *file, const char *func, int line, int showfunc,
|
||||||
|
LogLevel level, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
ssh_log(file, func, line, SYSLOG_LEVEL_FATAL, fmt, args);
|
ssh_log(file, func, line, showfunc, level, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
cleanup_exit(255);
|
cleanup_exit(255);
|
||||||
}
|
}
|
||||||
|
12
log.c
12
log.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: log.c,v 1.53 2020/10/16 13:24:45 djm Exp $ */
|
/* $OpenBSD: log.c,v 1.54 2020/10/17 01:28:20 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -427,23 +427,25 @@ sshlog(const char *file, const char *func, int line, int showfunc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sshlogdie(const char *file, const char *func, int line, const char *fmt, ...)
|
sshlogdie(const char *file, const char *func, int line, int showfunc,
|
||||||
|
LogLevel level, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
sshlogv(file, func, line, 0, SYSLOG_LEVEL_INFO, fmt, args);
|
sshlogv(file, func, line, showfunc, SYSLOG_LEVEL_INFO, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
cleanup_exit(255);
|
cleanup_exit(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sshsigdie(const char *file, const char *func, int line, const char *fmt, ...)
|
sshsigdie(const char *file, const char *func, int line, int showfunc,
|
||||||
|
LogLevel level, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
sshlogv(file, func, line, 0, SYSLOG_LEVEL_FATAL, fmt, args);
|
sshlogv(file, func, line, showfunc, SYSLOG_LEVEL_FATAL, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
23
log.h
23
log.h
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: log.h,v 1.25 2020/10/16 13:24:45 djm Exp $ */
|
/* $OpenBSD: log.h,v 1.26 2020/10/17 01:28:20 djm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
@ -71,12 +71,15 @@ void sshlog(const char *, const char *, int, int,
|
|||||||
LogLevel, const char *, ...) __attribute__((format(printf, 6, 7)));
|
LogLevel, const char *, ...) __attribute__((format(printf, 6, 7)));
|
||||||
void sshlogv(const char *, const char *, int, int,
|
void sshlogv(const char *, const char *, int, int,
|
||||||
LogLevel, const char *, va_list);
|
LogLevel, const char *, va_list);
|
||||||
void sshsigdie(const char *, const char *, int, const char *, ...)
|
void sshsigdie(const char *, const char *, int, int,
|
||||||
__attribute__((noreturn)) __attribute__((format(printf, 4, 5)));
|
LogLevel, const char *, ...) __attribute__((noreturn))
|
||||||
void sshlogdie(const char *, const char *, int, const char *, ...)
|
__attribute__((format(printf, 6, 7)));
|
||||||
__attribute__((noreturn)) __attribute__((format(printf, 4, 5)));
|
void sshlogdie(const char *, const char *, int, int,
|
||||||
void sshfatal(const char *, const char *, int, const char *, ...)
|
LogLevel, const char *, ...) __attribute__((noreturn))
|
||||||
__attribute__((noreturn)) __attribute__((format(printf, 4, 5)));
|
__attribute__((format(printf, 6, 7)));
|
||||||
|
void sshfatal(const char *, const char *, int, int,
|
||||||
|
LogLevel, const char *, ...) __attribute__((noreturn))
|
||||||
|
__attribute__((format(printf, 6, 7)));
|
||||||
|
|
||||||
#define ssh_nlog(level, ...) sshlog(__FILE__, __func__, __LINE__, 0, level, __VA_ARGS__)
|
#define ssh_nlog(level, ...) sshlog(__FILE__, __func__, __LINE__, 0, level, __VA_ARGS__)
|
||||||
#define ssh_debug3(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_DEBUG3, __VA_ARGS__)
|
#define ssh_debug3(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_DEBUG3, __VA_ARGS__)
|
||||||
@ -85,9 +88,9 @@ void sshfatal(const char *, const char *, int, const char *, ...)
|
|||||||
#define ssh_verbose(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_VERBOSE, __VA_ARGS__)
|
#define ssh_verbose(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_VERBOSE, __VA_ARGS__)
|
||||||
#define ssh_log(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_INFO, __VA_ARGS__)
|
#define ssh_log(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_INFO, __VA_ARGS__)
|
||||||
#define ssh_error(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_ERROR, __VA_ARGS__)
|
#define ssh_error(...) sshlog(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_ERROR, __VA_ARGS__)
|
||||||
#define ssh_fatal(...) sshfatal(__FILE__, __func__, __LINE__, __VA_ARGS__)
|
#define ssh_fatal(...) sshfatal(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_FATAL, __VA_ARGS__)
|
||||||
#define ssh_logdie(...) sshlogdie(__FILE__, __func__, __LINE__, __VA_ARGS__)
|
#define ssh_logdie(...) sshlogdie(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_ERROR, __VA_ARGS__)
|
||||||
#define ssh_sigdie(...) sshsigdie(__FILE__, __func__, __LINE__, __VA_ARGS__)
|
#define ssh_sigdie(...) sshsigdie(__FILE__, __func__, __LINE__, 0, SYSLOG_LEVEL_ERROR, __VA_ARGS__)
|
||||||
|
|
||||||
#define debug ssh_debug
|
#define debug ssh_debug
|
||||||
#define debug1 ssh_debug1
|
#define debug1 ssh_debug1
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: ssh-keyscan.c,v 1.133 2020/10/16 13:24:45 djm Exp $ */
|
/* $OpenBSD: ssh-keyscan.c,v 1.134 2020/10/17 01:28:20 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
|
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
|
||||||
*
|
*
|
||||||
@ -635,13 +635,13 @@ do_host(char *host)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sshfatal(const char *file, const char *func, int line,
|
sshfatal(const char *file, const char *func, int line, int showfunc,
|
||||||
const char *fmt, ...)
|
LogLevel level, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
ssh_log(file, func, line, SYSLOG_LEVEL_FATAL, fmt, args);
|
ssh_log(file, func, line, showfunc, level, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
cleanup_exit(255);
|
cleanup_exit(255);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user