From: Kefu Chai Date: Mon, 16 Nov 2020 07:18:33 +0000 (+0800) Subject: log/Log: cast parameter of syslog() from unsigned to int X-Git-Tag: v16.1.0~580^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7ba8a611e92688abaa55001a9e59d13e55b32d78;p=ceph.git log/Log: cast parameter of syslog() from unsigned to int silences warning like: ../src/log/Log.cc:325:34: warning: field precision should have type 'int', but argument has type 'std::basic_string_view::size_type' (aka 'unsigned long') [-Wformat] syslog(LOG_USER|LOG_INFO, "%.*s", s.size(), s.data()); ~~^~ ~~~~~~~~ 1 warning generated. Signed-off-by: Kefu Chai --- diff --git a/src/log/Log.cc b/src/log/Log.cc index 0af1db8b6c37..6d2647f579fe 100644 --- a/src/log/Log.cc +++ b/src/log/Log.cc @@ -322,7 +322,7 @@ void Log::_log_message(std::string_view s, bool crash) std::cerr << "problem writing to " << m_log_file << ": " << cpp_strerror(r) << std::endl; } if ((crash ? m_syslog_crash : m_syslog_log) >= 0) { - syslog(LOG_USER|LOG_INFO, "%.*s", s.size(), s.data()); + syslog(LOG_USER|LOG_INFO, "%.*s", static_cast(s.size()), s.data()); } if ((crash ? m_stderr_crash : m_stderr_log) >= 0) {