From a95a43a6bb7cada85f997d5f96f611967addf607 Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Sun, 12 Jul 2015 19:42:49 +0200 Subject: [PATCH] Save errno to prevent debugs from clobbering it --- src/debug.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/debug.cc b/src/debug.cc index 5d573a8abb..85a03772d4 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -470,7 +470,8 @@ _db_rotate_log(void) #endif errno = 0; if (rename(from, to) == -1) { - debugs(0, DBG_IMPORTANT, "log rotation failed: " << xstrerror()); + const auto saved_errno = errno; + debugs(0, DBG_IMPORTANT, "log rotation failed: " << xstrerr(saved_errno)); } } -- 2.47.2