Browse Source

logv: preserve errno.

Logging often gets called in error paths, so this is just good hygiene.
Also, log_io does this already.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
parent
commit
c076534220
  1. 2
      lightningd/log.c

2
lightningd/log.c

@ -232,6 +232,7 @@ static struct log_entry *new_log_entry(struct log *log, enum log_level level)
void logv(struct log *log, enum log_level level, const char *fmt, va_list ap)
{
int save_errno = errno;
struct log_entry *l = new_log_entry(log, level);
l->log = tal_vfmt(l, fmt, ap);
@ -241,6 +242,7 @@ void logv(struct log *log, enum log_level level, const char *fmt, va_list ap)
log->lr->print_arg);
add_entry(log, l);
errno = save_errno;
}
void log_io(struct log *log, bool in, const void *data, size_t len)

Loading…
Cancel
Save