diff options
| author | Kyle Evans <kevans@FreeBSD.org> | 2026-04-28 20:51:50 +0000 |
|---|---|---|
| committer | Kyle Evans <kevans@FreeBSD.org> | 2026-04-28 20:51:50 +0000 |
| commit | fe9d81d7c6602e9b18cde2aaf8cbd5f65b87c091 (patch) | |
| tree | 5b730bacddb0b6674594eb20652aa0f8c5d5b58b | |
| parent | 4429630d1ca9d90c886bae1eaa0d8ee32d0fee12 (diff) | |
libiscsiutil: preserve errno across warning logs
Various calls in the implementation can clobber errno; preserve it for
the caller since none of these will bubble up pass/fail to simplify
some future error handling in ctld.
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D56539
| -rw-r--r-- | lib/libiscsiutil/log.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libiscsiutil/log.c b/lib/libiscsiutil/log.c index cead4ab2d709..a48a96a7d47a 100644 --- a/lib/libiscsiutil/log.c +++ b/lib/libiscsiutil/log.c @@ -86,7 +86,7 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) static char msgbuf[MSGBUF_LEN]; static char msgbuf_strvised[MSGBUF_LEN * 4 + 1]; char *errstr; - int ret; + int ret, serrno = errno; ret = vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap); if (ret < 0) { @@ -138,6 +138,8 @@ log_common(int priority, int log_errno, const char *fmt, va_list ap) msgbuf_strvised, errstr); } } + + errno = serrno; } void |
