Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Apr 2026 20:52:16 +0000
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: fe9d81d7c660 - main - libiscsiutil: preserve errno across warning logs
Message-ID:  <69f11e00.3aee4.13ab5446@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=fe9d81d7c6602e9b18cde2aaf8cbd5f65b87c091

commit fe9d81d7c6602e9b18cde2aaf8cbd5f65b87c091
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2026-04-28 20:51:50 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-04-28 20:51:50 +0000

    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
---
 lib/libiscsiutil/log.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f11e00.3aee4.13ab5446>