|
@ -1,4 +1,4 @@ |
|
|
/* $OpenBSD: log.c,v 1.16 2017/01/09 14:49:22 reyk Exp $ */ |
|
|
|
|
|
|
|
|
/* $OpenBSD: log.c,v 1.17 2017/03/21 12:06:56 bluhm Exp $ */ |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> |
|
|
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> |
|
@ -124,17 +124,17 @@ log_warn(const char *emsg, ...) |
|
|
|
|
|
|
|
|
/* best effort to even work in out of memory situations */ |
|
|
/* best effort to even work in out of memory situations */ |
|
|
if (emsg == NULL) |
|
|
if (emsg == NULL) |
|
|
logit(LOG_CRIT, "%s", strerror(saved_errno)); |
|
|
|
|
|
|
|
|
logit(LOG_ERR, "%s", strerror(saved_errno)); |
|
|
else { |
|
|
else { |
|
|
va_start(ap, emsg); |
|
|
va_start(ap, emsg); |
|
|
|
|
|
|
|
|
if (asprintf(&nfmt, "%s: %s", emsg, |
|
|
if (asprintf(&nfmt, "%s: %s", emsg, |
|
|
strerror(saved_errno)) == -1) { |
|
|
strerror(saved_errno)) == -1) { |
|
|
/* we tried it... */ |
|
|
/* we tried it... */ |
|
|
vlog(LOG_CRIT, emsg, ap); |
|
|
|
|
|
logit(LOG_CRIT, "%s", strerror(saved_errno)); |
|
|
|
|
|
|
|
|
vlog(LOG_ERR, emsg, ap); |
|
|
|
|
|
logit(LOG_ERR, "%s", strerror(saved_errno)); |
|
|
} else { |
|
|
} else { |
|
|
vlog(LOG_CRIT, nfmt, ap); |
|
|
|
|
|
|
|
|
vlog(LOG_ERR, nfmt, ap); |
|
|
free(nfmt); |
|
|
free(nfmt); |
|
|
} |
|
|
} |
|
|
va_end(ap); |
|
|
va_end(ap); |
|
@ -149,7 +149,7 @@ log_warnx(const char *emsg, ...) |
|
|
va_list ap; |
|
|
va_list ap; |
|
|
|
|
|
|
|
|
va_start(ap, emsg); |
|
|
va_start(ap, emsg); |
|
|
vlog(LOG_CRIT, emsg, ap); |
|
|
|
|
|
|
|
|
vlog(LOG_ERR, emsg, ap); |
|
|
va_end(ap); |
|
|
va_end(ap); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|